Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Profiling Rebol API to DyBASE

From: knizhnik:garret:ru at: 19-Dec-2003 18:26

Hello Romano, Friday, December 19, 2003, 2:51:19 PM, you wrote: RPT> Hi, RPT> Just seem that clear waste hash table, perhaps this is a bug in clear. Yes, I already noticed it. So it is much cheaper to create new object than clean existed. RPT> These are my tests:
>>> i: 100000 loop 5 [recycle s: now/precise h: make hash! i * 2 + 2 repeat n i
RPT> [find h n insert insert tail h n RPT> make object! [a: 1] if 99 = (n // 100)[clear h]] print [i difference RPT> now/precise s] i: i + 25000] RPT> 100000 0:00:12.97 RPT> 125000 0:00:19.28 RPT> 150000 0:00:26.86 RPT> 175000 0:00:35.37 RPT> 200000 0:00:47.01
>>> i: 100000 loop 5 [recycle s: now/precise h: make hash! i * 2 + 2 repeat n i
RPT> [find h n insert insert tail h n RPT> make object! [a: 1]] print [i difference now/precise s] i: i + 25000] RPT> 100000 0:00:03.96 RPT> 125000 0:00:05.33 RPT> 150000 0:00:06.98 RPT> 175000 0:00:09.06 RPT> 200000 0:00:09.83 RPT> --- RPT> Ciao RPT> Romano RPT> ----- Original Message ----- RPT> From: "Romano Paolo Tenca" <[rotenca--telvia--it]> RPT> To: <[rebol-list--rebol--com]> RPT> Sent: Friday, December 19, 2003 4:49 AM RPT> 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 *
RPT> 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 >> [rebol-request--rebol--com] with unsubscribe as the subject. >>
-- Best regards, Konstantin mailto:[knizhnik--garret--ru]