[REBOL] Re: Profiling Rebol API to DyBASE
From: rotenca:telvia:it at: 19-Dec-2003 4:49
Hi,
> 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)]
1) For what i understand, you allocate a 200.000 slot hash, then clear the
cache every 100 item. Why?
2) The last thing: time consuming task here is clear.
3) Another thing: if you make hash! n then you should insert n item not n * 2
(with insert insert)
Remember that Rebol uses internal and hidden keys to hash. Your oid value is
internally hashed like any other value.
---
Ciao
Romano