Making Revolution faster with really big arrays

Dennis Brown see3d at writeme.com
Thu Apr 28 11:59:15 EDT 2005


On Apr 28, 2005, at 10:18 AM, Frank D. Engel, Jr. wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> I haven't actually tried it with this type of algorithm, so I really 
> don't know, and I've already deleted the eMail with the sample code; 
> you'd need to send that code out again for me to even try testing it 
> for you.
>
> The docs for pl/pgsql are part of the standard PostgreSQL docs on 
> their web site.
>
>
> On Apr 28, 2005, at 7:55 AM, Dennis Brown wrote:
>
>> Frank,
>>
>> That sounds interesting.  How fast can PostgreSQL generate the simple 
>> example I showed using an item by item algorithm?  Will it really 
>> execute faster than Transcript?
>>
>> Dennis
>> On Apr 27, 2005, at 6:39 PM, Frank D. Engel, Jr. wrote:
>>

Frank,

This is a simplified algorithm that I think would best translate 
directly between Transcript and PostgreSQL for a time trial.  Just make 
sure the PostgreSQL code is an item by item algorithm also.

Thanks,
Dennis

Transcript output on my machine:  1,000,000 Element Sum = 500500000 
Elapsed Time = 11.467659 seconds.

on mouseUp
   global gTestArray
   if number of lines of the keys of gTestArray is not 1000000 then 
--already done the init
     put empty into gTestArray --start with an empty a variable
     repeat with x = 1 to 1000
       repeat with y = 1 to 1000
         put x into gTestArray[x,y]
       end repeat
     end repeat
   end if
   --
   put the long seconds into st
   Method6
   get the long seconds
   put " Elapsed Time ="&&(it - st)&&"seconds." after msg
end mouseUp

on Method6 -- Add elements using keyed arrays
   global gTestArray
   put 0 into total
   repeat with x = 1 to 1000
     repeat with y = 1 to 1000
       add gTestArray[x,y] to total
     end repeat
   end repeat
   put "1,000,000 Element Sum = "&total
end Method6
-- 


More information about the use-livecode mailing list