Result of latest DocKimbel version on my Dell laptop...
>> Elapsed time for adding 200000 records 0:00:01.221

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Friday, December 19, 2003 4:58 AM
To: [EMAIL PROTECTED]
Subject: [REBOL] Re: Profiling Rebol API to DyBASE



Hi Konstantin,

Here's a version executing 10 times faster. I just changed h series type
from 
hash! to list!. Looks like in your case, cost for adding data is much higher

than for searching keys...

Regards,
-DocKimbel

n: 200000
h: make list! n
l: make block! n
start: now/time/precise
repeat i n [
    oid: random n 
    pos: find h oid    
    either pos [
        obj: pick l index? pos
    ][
        obj: make object! [__oid__: oid]
        insert tail h oid
        insert tail l obj
    ]
    if zero? i // 100 [clear h clear l]
]
print ["Elapsed time for adding" n "records" (now/time/precise - start)]

Selon Konstantin Knizhnik <[EMAIL PROTECTED]>:

> 
> Hello Gregg,
> 
> I was able to isolate the problem.
> The following script shows almost the same time as testindex.r 
> searching for 200000 objects.
> 
> 
> n: 200000
> h: make hash! n
> start: now/time/precise
> repeat i n [
>     oid: random n 
>     obj: select h oid
>     if none? obj [
>        obj: make object! [__oid__: oid]
>        insert insert tail h oid obj
>     ]
>     if (i // 100) = 0 [clear h]
> ]
> 
> print ["Elapsed time for adding" n "records" (now/time/precise - 
> start)]
> 
> At my computer execution of this script takes about 70 seconds. By 
> replacing it with:
> 
> n: 200000
> h: make hash! n
> l: make block! n
> start: now/time/precise
> repeat i n [
>     oid: random n 
>     pos: find h oid    
>     either none? pos [
>        obj: make object! [__oid__: oid]
>        insert tail h oid
>        insert tail l obj
>     ] [obj: pick l index? pos]
>     if (i // 100) = 0 [clear h clear l]
> ]
> 
> print ["Elapsed time for adding" n "records" (now/time/precise - 
> start)]
> 
> 
> 
> I was able to reduce execution time till 33 seconds.
> 
> Are there some better ideas how to improve performance of this peace 
> of code?
 
-- 
To unsubscribe from this list, just send an email to [EMAIL PROTECTED]
with unsubscribe as the subject.
-- 
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.

Reply via email to