HC Music that should be on Runtime Revolution
Bob Sneidar
bobs at twft.com
Tue Mar 17 20:05:28 EDT 2009
Hi Colin.
Your test is wrong on several levels. I ran this script:
ON mouseUp
put "abcdefghijklmnopqrstuvwxyz1234567890" into theValue
put the ticks into StartFieldTime
REPEAT FOR 10000
put theValue into field TestField
get field TestField
END repeat
put the ticks into EndFieldTime
set the tValue of me to theValue
put the ticks into StartPropTime
REPEAT FOR 10000
set the tValue of me to theValue
get the tValue of me
END repeat
put the ticks into EndPropTime
put (EndFieldTime - StartFieldTime) & "," & (endPropTime -
StartPropTime)
END mouseUp
I got 350,2 as a result. That is, setting and getting a property is
exactly 125 times faster than putting and getting the samve value in a
field.
1. In your example you used the form repeat with a = 1 to 10000. That
creates a variable called a and sets the value of that variable 10000
times. That at least mucks up the experiment a bit.
2. You were getting the ENTIRE PROPERTY SET of an object, not just the
value of a property. Not even remotely close to a fair fight!
3. Your first repeat loop was one million whereas the second repeat
loop was One Hundered Thousand. Not sure why the disparity there...
4. You were only GETTING the value of the field, not PUTTING data into
the field. The experiment I presume was about both STORING and
RETRIEVING data?
Hope this helps.
Bob Sneidar
IT Manager
Logos Management
Calvary Chapel CM
On Mar 17, 2009, at 4:42 PM, Colin Holgate wrote:
>
> 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.
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
More information about the use-livecode
mailing list