Speed

Jim Hurley jphurley at jps.net
Sat Feb 23 08:51:01 CST 2002


>On Friday, February 22, 2002, at 06:22  AM, Jim Hurley wrote:
>
>  > I concede the difficulties in speedily running color vs. black and
>>  white, and the improvement in the current release is much appreciated.
>>  However there remains a considerable gap between MC/RR and HC. For
>>  example, the following script draws concentric boxes of ever decreasing
>>  size.
>>
>>  on mouseUp
>>    clean
>>    put 100 into a
>>    put  300 into b
>>    put 2 into da
>>    choose the line tool
>>    put the ticks into startTime
>>    repeat 50 --draw boxes of ever decreasing size
>>      drag from a,a to b,a
>>      drag from b,a to b,b
>>      drag from b,b to a,b
>>      drag from a,b to a,a
>>      add da to a
>>      subtract da from b
>>    end repeat
>>    put the ticks - startTime into field 1
>>    choose the browse tool
>>  end mouseUp
>>
>>  on clean
>>    repeat until the number of images = 0
>>      delete image 1
>>    end repeat
>>  end clean
>>
>>  This script takes 265 ticks on average in RR and  30 ticks in HC on
>>  cards of identical size. (I realize that this can be done more
>>  efficiently with the rectangle tool and that a graphic would be faster
>>  than an image. My  purpose was to measure the drag speed. ) The
>>  discrepancy would be less in Windows.

Scott Rossi wrote:

>Since I'm fairly entrenched in graphics work, this post caught my eye. 
>One thing you need to keep in mind with MC/REV is that usually, not
>always, but usually there are similar ways to achieve what you've done
>before using alternate methods.  For example, I ran the above script and
>timed a rough average of 111 ticks.  Then instead of choosing the line
>tool, I chose the pencil tool, and drawing time was reduced to 37
>ticks.

Scott,

Thank you sooooo much! This choice of the pencil is a real find--for 
me. It not only make turtle graphics viable on MC and RR but it is 
even faster than HC. This difference between the line tool and the 
pencil tool is, I think, undocumented in RR or MC.

  The pencil tool in MC is not the same as the pencil tool in HC. (The 
above script draws an altogether different figure in HC.) In HC the 
pencil tool draws black if the initial screen point is white and 
white if the initial screen point is black--it acts like the "fat 
bits tool." Fortunately, in MC it always draw whatever the pen color 
is; the color of the starting point is irrelevant. However, unlike 
the line tool, it is not possible to vary the pen width--a small 
price to pay for the increase in speed. Furthermore, unlike the line 
tool, the drawing  speed is apparently unaffected by the card 
dimensions. Drawing with the line  tool becomes increasing  slow as 
the card dimensions increase.

>Adding a "lock screen" reduced the overall time to 9 ticks --
>virtually immediate.

In most of my applications in education, it is important for the 
student to see the path evolving in time and so locking  the screen 
is not an option.

I hope the other Scott will help us to understand the difference 
between the  pencil and line tools and why the pencil tool is soooo 
much faster.

Jim Hurley



More information about the use-livecode mailing list