Speeding+up+graphics+plotting

//by Richard Russell, December 2013//

You may occasionally find that plotting graphics in LBB is a little slower than in LB 4.04; this results from the overhead of the emulator. This can often be resolved by sending fewer, longer, graphics commands.

For example this code runs noticeably more slowly in LBB: code format="lb" #gr "place ";x;" ";y for i = 1 to len(rest$) step 2 x1=asc(mid$(rest$,i, 1))-34-45 y1=asc(mid$(rest$,i+1,1))-34-45 x=x+x1 y=y+y1 #gr "goto ";x;" ";y next code But this simple modification makes it run more quickly in LBB than in LB4.04: code format="lb" gr$ = "place ";x;" ";y;";" for i = 1 to len(rest$) step 2 x1=asc(mid$(rest$,i, 1))-34-45 y1=asc(mid$(rest$,i+1,1))-34-45 x=x+x1 y=y+y1 gr$ = gr$;"goto ";x;" ";y;";" next #gr gr$ code Here the graphics commands have been concatenated into a single string **gr$** which is then output as a single statement.

Any number of graphics commands, within reason, can be concatenated into a single string, with the exception that a **text output** command (if any) must be the last thing in the string. So, when possible, the best performance will be achieved by outputting text only after everything else has been drawn, to maximise the number of commands than can be combined in a single string.