Repeat for each

Alex Tweedly alex at tweedly.net
Thu Nov 10 06:15:09 EST 2005


Marty Knapp wrote:

> Alex Tweedly wrote:
>
>> Marty Knapp wrote:
>>
>>>
>>> I've been tinkering with this a bit and wanted to ask a few more 
>>> questions. Again, my data set is 8 items with all but one being a 
>>> number. I need to be able to select a subset by analysing 1 or more 
>>> of these items. My current data set is approx 128,000 records. When 
>>> I filter the data on the item that contains words, it's pretty fast 
>>> - about 1 second (I have an old Mac G4-single processor 867mgz, and 
>>> running Rev 2.2.1) The speed is exactly the same whether I use the 
>>> above method or just 'filter theData with "*word*"'
>>>
>> That seems terribly slow to me :-)
>
>
>
> That's what I thought! Interestingly enough in my repeat for each loop 
> I had "set cursor to busy" and that's what was bring this thing to its 
> knees. I knew that a progress indicator was a hog, but had no idea 
> that this would take such a heavy toll. Searches that were running 5 
> minutes now take about 5 seconds. 

Not too surprising - if you want to keep the busy cursor (worth it for a 
5 sec loop, IMHO), I'd put it into a conditional

   add 1 to tBusyCounter
   if tBusyCounter mod 1000 = 0 then set cursor to busy

> That still isn't terribly fast - maybe my older computer is to blame? 
> Are there any speed improvements between the current version of Rev 
> and mine (2.2.1)?
>
Yes there are some documented ones (e.g. replace char substring with 
another of the same length is dramatically faster than it used to be, I 
believe since 2.2.1).
In this case (with my existing data and code), seems to be no more than 
twice as fast (or half as fast).

(I tested this both with and without "suspend dev tools" in case that 
made a difference)

       filter     repeat for
2.2.1     180        103  
2.2.1     179        104      suspended

2.5       180        110 
2.5       179        104      suspended

2.6.1      98        180     (1)
2.6.1     100        400     (2)   suspended

(1) it looks as though filter got some speed improvements, while 
something slowed down the repeat for loop.

(2) I have no clue why suspending dev tools should have a *negative* 
effect on the reported speed.



-- 
Alex Tweedly       http://www.tweedly.net



-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.362 / Virus Database: 267.12.8/162 - Release Date: 05/11/2005




More information about the use-livecode mailing list