HC Music that should be on Runtime Revolution
Colin Holgate
coiin at rcn.com
Tue Mar 17 19:42:50 EDT 2009
On Mar 17, 2009, at 6:41 PM, J. Landman Gay wrote:
>
> It isn't really. Fields are probably the most inefficient place to
> store data that you need to access a lot.
For what I was trying, playing a whole tune, I would only need the
data once. Did you try my script? Does it not work fast for you too?
As for fields being slower than customproperties, it seems that may
not be true, at least in the case of text. Try this script, after
putting some text in the field (I had just over 7k):
set the customproperties of player 1 to field 1
put the ticks into t
repeat with a = 1 to 1000000
get field 1
end repeat
put the ticks - t into t1
put the ticks into t
repeat with a = 1 to 100000
get the properties of player 1
end repeat
put t1 && the ticks - t
The figures I got were 198 and 325 ticks. If I was arguing that fields
was a bit faster, then 198 to 325 would prove that. But note that the
routine gets the text from the field a million times, and only gets
the customproperties 100,000 times. You can try the customproperties a
million times too, but you'll think your machine has crashed.
So, at least in this case retrieving from a field is about 1,600 times
as fast as retrieving from customproperties, and retrieving once from
a field is taking about 3.3 microseconds. That's close enough to
instantaneous for me.
More information about the use-livecode
mailing list