why are custom properties so fast?

Sarah Reichelt sarahr at genesearch.com.au
Tue May 17 02:26:40 EDT 2005


On 14 May 2005, at 2:52 PM, Richard Gaskin wrote:

> Compared to a field nearly anything else will be faster because of the 
> overhead associated with all the other things fields have to do to 
> display text in addition to storing it.
>
This topic has come up a few times lately, so I decided it was time to 
do some timing tests :-)

I had a field with 1000 lines of data put into a variable, then put the 
variable back into the field 50 times.
Then I did the same with a custom property, first getting the test data 
from the field (so it was identical) then setting & getting the 
property repeatedly.

The fastest method was using a custom property with messages locked.

Here are my test results:

using a field	740 ticks
using a field (with locked screen)	405 ticks
using a field from sub stack	230 ticks
using a field from a sub stack & locking the screen	235 ticks

The sub-stack's window was not open for these tests. Opening it made 
the times the same as for a field on the stack running the tests.

To get meaningful data for the custom property tests, I had to do 500 
repeats, instead of just 50!
But dividing my average results then by 10, I got:

using a custom property	1.9 ticks
using a custom property with messages locked	0.3 ticks

This is almost 2500 times faster than the field method!!!!!

Removing the scroll bar from the field had almost no effect.

I really didn't expect to come up with such a big difference, but I 
expect it will only change my habits in certain circumstances. I like 
the convenience of being able to see my data when necessary so tend to 
use the closed sub-stack method. However if you have a vast amount of 
data to shuffle around and it needs to be done fast, this is a good 
method to remember.

Cheers,
Sarah



More information about the use-livecode mailing list