custom property searching speed question

Richard Gaskin ambassador at fourthworld.com
Wed Mar 2 17:36:14 EST 2005


Lynch, Jonathan wrote:
> More tinkering and testing of timing...
> 
> I changed the customproperty set so that it contains 500,000 records
> with 3 items in each record.
> 
> Item 1, the name of the element
> Item 2, a bunch of words
> Item 3, a number (100)
> 
> I created a script that gets the sum of column 3 of this data set - that
> is, it adds up item 3 for each element.
> 
> This script:
> 
> on mouseUp
>   put the milliseconds into M
>   put the customproperties of field "theData" into myArray
>   put 0 into tSum
>   set the itemdelimiter to numtochar(30)
>   repeat for each element E in myArray
>    add item 3 of E to tSum
>   end repeat
>   put tSum into field "output"
>   put ((the milliseconds)-M)/1000 into field "feedback"
> end mouseUp
> 
> produces the correct result in .486 seconds!
> 
> Half a second to sum a column of 500,000 items! 

What kind of hardware are you using?  Tests like that usually take me at 
least 2 seconds on my PBG4/1KHz.

Have you tried looping through lines in a combined string? If your 
results are like mine you'll shave another 20% off.

Yep, kinda hard to beat the performance of a RAM-based database when you 
have the RAM to architect like that...

-- 
  Richard Gaskin
  Fourth World Media Corporation
  ___________________________________________________________
  Ambassador at FourthWorld.com       http://www.FourthWorld.com


More information about the use-livecode mailing list