Hi,

Just seem that clear waste hash table, perhaps this is a bug in clear.

These are my tests:

>> i: 100000 loop 5 [recycle s: now/precise h: make hash! i * 2 + 2 repeat n i
[find h n insert insert tail h n
 make object! [a: 1]  if 99 = (n // 100)[clear h]] print [i difference
now/precise s] i: i + 25000]
100000 0:00:12.97
125000 0:00:19.28
150000 0:00:26.86
175000 0:00:35.37
200000 0:00:47.01

>> i: 100000 loop 5 [recycle s: now/precise h: make hash! i * 2 + 2 repeat n i
[find h n insert insert tail h n
 make object! [a: 1]] print [i difference now/precise s] i: i + 25000]
100000 0:00:03.96
125000 0:00:05.33
150000 0:00:06.98
175000 0:00:09.06
200000 0:00:09.83

---
Ciao
Romano

----- Original Message -----
From: "Romano Paolo Tenca" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, December 19, 2003 4:49 AM
Subject: [REBOL] Re: Profiling Rebol API to DyBASE


>
> 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
>
> --
> 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