SPAM-MED: Re: Time to upgrade my technique...

Richard Gaskin ambassador at fourthworld.com
Tue Jun 10 23:18:54 EDT 2008


J. Landman Gay wrote:
 > Moving data in and out of fields is one of the slowest, most
 > inefficient things you can do in Rev, so it's good practice
 > to do as little of it as possible. While it is true that today's
 > computers are fast, parsing a large field by repeatedly accessing
 > and replacing its contents will be very slow if there is any
 > substantial text in it.
 >
 > Richard, you wrote a great explanation of this on the list some
 > time ago. I wonder if you still have it. Something about moving
 > things around in the janitor's closet every time you needed to
 > get the cleaning fluid or something.

Of all the metaphors I've ever written, I felt that was one of the few 
accurate ones.  But you're the only person who remembers it at all. 
Maybe it's only funny to folks who've played around with the Mac Toolbox 
in C.  Maybe it's only funny to me.

For your amusement, from the May 2005 thread,
"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
  Managing Editor, revJournal
  _______________________________________________________
  Rev tips, tutorials and more: http://www.revJournal.com



More information about the use-livecode mailing list