Trouble with graphics display in OS X
James Hurley
jhurley at infostations.com
Mon Jan 24 17:15:29 EST 2005
Last installment in my "troubles" with the display in OS X.
Following suggestions from Jacqueline, I have compared four basic
methods of moving a RunRev control smoothly through a sequence of
points--with mixed results.
What follows are four scripts, all of which do the same, very simple
thing: Move a graphic 600 pixels horizontally across the screen. (I
realize one can do this in one step, but I am looking for a general
method to use in a library of Turtle Graphics. The path might be a
planetary orbit, or the path of an object in game, a game which would
involve user input. Therefore the point set cannot be determined in
advance.)
Below I have listed the results (time in ticks) for each method.
There are some surprising differences.
The stack generating these results can be reviewed; In the msg box:
go url "http://home.infostations.net/jhurley/DisplayProblems.rev"
Scripts:
Using: Move Relative
put 1,0 into tRelLoc
set the movespeed to 65535
repeat 600
move grc "ball" relative tRelLoc --without messages
end repeat
Using: Set the loc
put the loc of grc "ball" into tLoc
repeat 600
add 1 to item 1 of tLoc
set the loc of grc "ball" to tLoc
wait 0 millisec--In OS X only
end repeat
Using: Move to the points list
(First set the moveSpeed)
put the loc of grec "ball" into tLoc
repeat 600
put tLoc & return after tPoints
add 1 to item 1 of tLoc
end repeat
move grc "ball" to tPoints
Using: MoveStopped
initialize tLoc to 1,0
on moveStopped
if i < 600 then
add 1 to i
doMove
end if
end moveStopped
on doMove
move grc "ball" relative tLoc without waiting
end doMove
And the time to execute these four methods are:
OS X
Move relative, 64 ticks
Set the loc, 69 ticks --Wait 0 millisec
Move to points, 37 ticks--Or as small as 1 tick
Movestopped, 67 ticks
OS 9
Move relative, 12 ticks
Set the loc, 5 ticks--Wait 0 removed
Move to points, 37 ticks--Or as small as 1 tick
Movestopped, 12 ticks
Windows
Move relative, 309 ticks
Set the loc, 15 ticks--Wait 0 removed
Move to points, 1 ticks
MoveStopped, 321 ticks
end doMove
And the winner is: OS 9
I was astonished to discover how much slower Windows was in executing
"Move relative" and "MoveStopped."
The only one of the four which works for me is "Set the loc". My only
problem is the fact that it is so much slower in OS X than OS 9 or
Windows.
Jim
More information about the use-livecode
mailing list