Speeding up this handler
Geoff Canyon
gcanyon at inspiredlogic.com
Sat Apr 12 13:56:01 EDT 2003
You should first break down the problem to see what is slow. Off the
top of my head, possibilities include:
1. Updating images onscreen. (even though the screen is locked)
2. Loading data from a file.
3. Getting the data into an image.
4. The code you wrote to do 1,2, and 3.
2 and 3 are tough to separate since they're both part of
set the filename of image bMap[z] to line y of cMap[x]
First, try timing setting the filename of an image repeatedly to two
different files. See how long that takes. I'd bet you'll find that it
takes 99% of the time the routine you posted takes. In other words, the
overhead is all in setting the images, not in the routine you wrote to
do it.
If that's the case, you need to figure out what's slow among 1, 2, and
3.
Second, create two source images, and try timing setting the imagedata
of a third image repeatedly to the two source images, a, then b, then
a, etc. That should give you a good idea whether 1 and 3 are your
problem.
If 1 and 3 are the problem, try timing setting the icon of a button to
the two images, see if that is any faster.
If 1 and 3 aren't the problem, then consider 2. Others have suggested
ways of using images as a storage method. You might also simply store
the image data in an array. I don't know what the memory and
performance overhead is on an image that you never display, but it has
to be higher than an array (I think).
regards,
Geoff Canyon
gcanyon at inspiredlogic.com
More information about the metacard
mailing list