Re: processing time & stack overflow!!!
Re: processing time & stack overflow!!!
- Subject: Re: processing time & stack overflow!!!
- From: Jon Pugh <email@hidden>
- Date: Fri, 31 Aug 2001 09:47:10 -0700
At 8:03 AM -0400 8/31/2001, Victor Yee wrote:
>
Now, this is something that I use but don't really fully understand, so I'm the wrong guy to answer. But it seems that when manipulating lists, the "reference to" construct will save considerable amounts of processing.
Specifically, it avoids copying the data, which in this case is really big, so the more times you can avoid that, the better.
Good:
set bobs to {"Robert", "Bob", "Dick", "John", "Ralph", "Bud"}
set item 6 of bobs to "Henry" -- changes item 6 only
Bad:
set bobs to {"Robert", "Bob", "Dick", "John", "Ralph", "Bud"}
set bobs to (items 1 thru -2 of bobs) & "Henry" -- copies bobs & makes new bobs
Copying is the primary thing that computers do, and we need to do less of it. ;)
Jon