Skip to content

Instantly share code, notes, and snippets.

@tomaes
Created February 21, 2013 12:47
Show Gist options
  • Save tomaes/5004517 to your computer and use it in GitHub Desktop.
Save tomaes/5004517 to your computer and use it in GitHub Desktop.
some pattern drawing methods benchmarked (c64)
0 rem char screen pattern drawing methods and performance / commodore basic v2.0 (c64)
2 rem results for lines:
3 rem 10-> 18s (!)
4 rem 20-> 9s (same as 10, but twice as fast)
5 rem 30-> 3s (no PRNG? waay faster still)
6 rem 40/50-> <= 1s (cashed string 'brush' with and without PRNG, pretty fast)
7 rem all: <= 14s
9 ti$="000000"
10 for i=0 to 999: poke 1024+i,160+rnd(0)+0.5: next i
20 a=1024:b=2023:c=160:fori=atob:pokei,c+rnd(.)+.5:next
30 a=1024:b=2023:c=160:fori=atob:pokei,c:next
40 a$=chr$(117)+chr$(123)+chr$(117)+chr$(123):b=239:print"{home}";:fori=0tob:printa$;:next
50 a$=chr$(98+rnd(.)+.5)+chr$(98+rnd(.)+.5)+chr$(98+rnd(.)+.5)+chr$(98+rnd(.)+.5):b=239:print"{home}";:fori=0tob:printa$;:next
90 print "{home}{white}[time:"ti$"]{light blue}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment