Making Revolution faster with really big arrays
Frank D. Engel, Jr.
fde101 at fjrhome.net
Fri Apr 29 09:30:05 EDT 2005
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Did my earlier reply even make it through?
I'm not seeing it on the list. Transcript is actually faster than what
I was able to come up with for PostgreSQL -- much faster, in fact.
Ada is WAY faster than either one of them -- a fraction of a second for
this test.
On Apr 29, 2005, at 8:20 AM, Dennis Brown wrote:
> Read the earlier versions of this thread for the fast methods. This
> example is just for a specific test between Transcript and PostgreSQL
>
> Dennis
>
> On Apr 29, 2005, at 6:24 AM, Wouter wrote:
>
>>
>> On 28 Apr 2005, at 17:59, Dennis Brown 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
>>> --
>>>
>>
>> Hi again with a little addition,
>>
>> The initialization of the test array takes about 36 seconds.
>> Following version does the same in much shorter time:
>>
>> on mouseUp
>> put the long seconds into zap
>> --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 i = 1 to 1000
>> put i&comma after x
>> end repeat
>> repeat 1000
>> put x after gTestArray
>> end repeat
>> split gTestArray by comma
>> put the long seconds - zap
>> --end if
>> put the long seconds into st
>> Method6
>> get the long seconds
>> put " Elapsed Time ="&&(it - st)&&"seconds." after msg
>> end mouseUp
>>
>> In this case the initialization takes about 10 seconds on the slowbook
>> _______________________________________________
>> use-revolution mailing list
>> use-revolution at lists.runrev.com
>> http://lists.runrev.com/mailman/listinfo/use-revolution
>>
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
>
- -----------------------------------------------------------
Frank D. Engel, Jr. <fde101 at fjrhome.net>
$ ln -s /usr/share/kjvbible /usr/manual
$ true | cat /usr/manual | grep "John 3:16"
John 3:16 For God so loved the world, that he gave his only begotten
Son, that whosoever believeth in him should not perish, but have
everlasting life.
$
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Darwin)
iD8DBQFCcjbd7aqtWrR9cZoRAsWFAJ90AUksikgIFvNGJO7LAjozvn1aPgCeJ8+E
yOYp6RJFKwtMPJttHbmw4ws=
=PjBb
-----END PGP SIGNATURE-----
___________________________________________________________
$0 Web Hosting with up to 200MB web space, 1000 MB Transfer
10 Personalized POP and Web E-mail Accounts, and much more.
Signup at www.doteasy.com
More information about the use-livecode
mailing list