User Tools

Site Tools


speeding_20up_20graphics_20plotting

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

speeding_20up_20graphics_20plotting [2018/03/31 13:19]
127.0.0.1 external edit
speeding_20up_20graphics_20plotting [2018/04/17 18:53] (current)
tbest3112 Added syntax highlighting
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 ";​x;"​ ";y       #gr "place ";​x;"​ ";y
       for i = 1 to len(rest$) step 2       for i = 1 to len(rest$) step 2
Line 10: Line 11:
           #gr "goto ";​x;"​ ";y           #gr "goto ";​x;"​ ";y
       next       next
 +</​code>​
 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 ";​x;"​ ";​y;";"​       gr$ = "place ";​x;"​ ";​y;";"​
       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$
 +</​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. 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: 2018/03/31 13:19 by 127.0.0.1