Another speed dilemma

Shari gypsyware at earthlink.net
Fri Apr 18 18:03:01 EDT 2003


I originally started out with 300 map sections, and if you enter a 
new section, there is a pause while the new section data loads.  This 
pause was not a big issue, but this approach does present some other 
difficulties, which I won't go into here.

So I tried putting the data from all 300 sections into an array. 
Element 1 held the data for Section 1, Element 2 = Section 2, etc.

This worked great, until you leave Section 1.  Then it slows drastically.

I tried putting it into a variable.  Same result.  As long as the man 
was in Section 1, he zipped along.  The moment he went to another 
section, slowpoke time.

In a single variable, I end up with 330 lines, with 860 items per line.

I tried using lineOffset to get the data faster, but no go.  In the 
handler that accesses the data, it goes right to the lines it needs, 
it does not start at 1.  But it's as though behind the scenes, 
something has to read every line before to get to the lines in 
question.

The farther away from the starting point you get, the slower he moves.

Is there a fast way to access data from a huge variable or array, if 
the data is way down the list?  When gRow gets up there in numbers, 
big bad slowdown.

In an array:

repeat with x = gRow to (gRow + 8)
     repeat with y = gCol to (gCol + 10)
       set the icon of cd btn bMap[z] to (line y of uMap[x])
       add 1 to z
     end repeat
   end repeat

In a variable:

repeat with x = gRow to (gRow + 8)
     repeat with y = gCol to (gCol + 10)
       set the icon of cd btn bMap[z] to item y of line x of uMap
       add 1 to z
     end repeat
   end repeat

Shari C
-- 
--Shareware Games for the Mac--
http://www.gypsyware.com



More information about the metacard mailing list