Re: animation

emlowe@fsa.ca
Thu, 17 Aug 1995 17:09:50 -0700 (MDT)

>
> >
> > This is so *unbearably* slow that it is completely useless. Even merely
> > putting a constant value into the field is as slow - it's the overhead
> > of the "put" command. Anything else with less overhead?.
>
> It isn't the "put" command that's the problem, it's the field text
> reformatting routines and redraw. While I'd disagree that your
> example runs unacceptably slow (it tracks well enough here to be at
> least usable), this overhead is why it's a not a good idea to use
> fields as containers in calculation intensive scripts. Instead, put
> the field contents into a variable, operate on the variable, then put
> the results back into the field afterwards.
>
> You can dramatically improve the performance of your example by not
> setting the field contents unless the mouseLoc has changed. For
> example:
>
> on mouseDown
> put the mouseLoc into oldloc
> repeat while the mouse is down
> if the mouseLoc is not oldloc then
> put the mouseLoc into oldloc
> set the loc of me to oldloc
> put oldloc into field 1
> end if
> end repeat
> end mouseDown

Well, I'll try something like, although my example wasn't exactly
representative of what I am trying to accomplish, I can probably do
something similar. I'm not using the field as a container for
calculation purposes, I use a variable, and only use the field to
display the value, but it causes the same problems.

>
> > Note that using an idle handler like mouseStillDown works better, but
> > is fairly chunky due to the idle time. (The idle time can be made
> > smaller, but I'm not sure what other effects this will have)
>
> I can't see why this would be better unless you're running across a
> highly loaded network or to a slow X server, in which case the script
> could get way ahead of the object redrawing. The repeat-loop approach
> should be a lot faster when running on a local system or between two
> relatively balanced systems.
> Scott
>

Perhaps I should have mentioned that I am remotely running this over a
network, although the network isn't particularly overloaded. A slow X
server, hmmm, would an old Personal IRIS count...most likely.

I just tried it on a SPARC 1 (certainly not a speed demon) locally and
the performance was acceptable using the repeat loop. Sometimes I
forget about the network thing ;-).

-Earle

-- 
Earle Lowe
emlowe@fsa.ca
FSA Corporation
Performance and system software for UNIX networks.