speeding_20up_20graphics_20plotting
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
speeding_20up_20graphics_20plotting [2018/03/31 13:19] – external edit 127.0.0.1 | speeding_20up_20graphics_20plotting [2024/01/05 00:21] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 2: | Line 2: | ||
//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: | //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 lb> | ||
#gr "place "; | #gr "place "; | ||
for i = 1 to len(rest$) step 2 | for i = 1 to len(rest$) step 2 | ||
Line 10: | Line 11: | ||
#gr "goto "; | #gr "goto "; | ||
next | next | ||
+ | </ | ||
But this simple modification makes it run more quickly in LBB than in LB4.04: | But this simple modification makes it run more quickly in LBB than in LB4.04: | ||
+ | <code lb> | ||
gr$ = "place "; | gr$ = "place "; | ||
for i = 1 to len(rest$) step 2 | for i = 1 to len(rest$) step 2 | ||
Line 20: | Line 23: | ||
next | next | ||
#gr gr$ | #gr gr$ | ||
+ | </ | ||
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. | 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. |
speeding_20up_20graphics_20plotting.1522502384.txt.gz · Last modified: 2024/01/05 00:16 (external edit)