Performance Mystery Solved - IT'S THE DATA STUPID!!
Richard Gaskin
ambassador at fourthworld.com
Thu Nov 11 21:00:48 EST 2010
Monte Goulding wrote:
> I never said it wasn't loaded into memory. I know it is and it
> didn't make sense to me at the time that there would be such a
> performance difference. Maybe it was something to do with
> resolving the filename? I'm not sure, I just know it was slower.
There's probably some nuance I'm missing - here's a quick test which
first uses the fileName of a stack to access a property, then the next
run it opens the stack and gets the property by referring to the stack's
short name (FWIW, I had saved the stack previously with its destroyStack
set to true to try to maximize any load difference):
on mouseUp
put 10000 into n
put fld "file" into tStackFile
--
put the millisecs into t
repeat n
put the uTest of stack tStackFile into r1
end repeat
put the millisecs - t into t1
--
put the millisecs into t
toplevel tStackFile
put the short name of stack tStackFile into tStack
repeat n
put the uTest of stack tStack into r2
end repeat
close stack tStackFile
put the millisecs - t into t2
--
put t1 && t2 &&(r1=r2) into fld "r"
end mouseUp
Result: 151 140 true
The difference is small even across 10,000 iterations, and can be
explained by the need to resolve the path to a stack reference.
How can this test be modified to show a greater difference?
--
Richard Gaskin
Fourth World
LiveCode training and consulting: http://www.fourthworld.com
Webzine for LiveCode developers: http://www.LiveCodeJournal.com
LiveCode Journal blog: http://LiveCodejournal.com/blog.irv
More information about the use-livecode
mailing list