why are custom properties so fast?
Richard Gaskin
ambassador at fourthworld.com
Sat May 14 00:51:01 EDT 2005
Howdy Eric -
Erik Hansen wrote:
> --- Richard Gaskin <ambassador at fourthworld.com>
> wrote:
>
>> The inventor of the engine, Scott Raney, once
>> recommended to me to use stacks with only about
>> 5,000 cards, and if you need more you'll get
>> better performance using a database like
>> Valentina for storage and retrieval.
>>
>> But Dr. Raney overlooked the beauty and
>> simplicity of his own custom properties.
>> I've worked on projects with tens
>> of thousands of custom properties with
>> narry a blink.
>
> why are custom properties so fast?
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.
I wrote this a while back in response to a related question:
To get data in and out of a field, given the various style run
mechanisms and other special considerations, the process is a lot more
work under the hood than using a custom property.
For the benefit of anyone who's never had to deal with the tedium of
low-level languages, you can visualize what's happening by imagining
needing to alter the contents of two buckets:
1. PROPERTY: This bucket is on the floor right in front of you.
2. FIELD: This bucket is in a room down the hall and around the corner,
turn left, then go through the first door, turn right, go through the
double-doors, then take the hall on the left to the staircase, go
downstairs, and on your right you'll find a storage bin -- the bucket is
in the bin, behind a mop. Before you can pick up the bucket you'll need
to move the mop, but the mop is wet so you'll need to put some rags on
the floor in front of you to catch the moisture so it doesn't make the
floor unsafe. You'll find some rags in the next room through the door on
the right, inside a metal box. Be sure to put the lid back on the box
after retrieving the rags so you don't let mice nest there. Back in the
storage room spread the rags out sufficiently to catch the moisture but
not so many that you trip over them, then put the mop on them, and then
get the bucket. After changing the bucket's contents you'll want to put
it back first, then the mop, then collect all of the rags and put them
in the laundry hamper in the room on the left. To make sure the cleaning
crew knows to wash the rags you'll need to fill out the laundry request
form you'll find on a clipboard hanging on the wall next to the light
switch. After it's filled out be sure to turn off the light in the
laundry room and the one in the storage room, and then return to where
you started.
In terms of the number of instructions to access the contents of a
property vs. a field, this comparison with buckets is probably missing a
few steps in #2. And if there's a scrollbar attached to the field then
double the number of steps. :)
--
Richard Gaskin
Fourth World Media Corporation
__________________________________________________
Rev tools and more: http://www.fourthworld.com/rev
More information about the use-livecode
mailing list