[REBOL] Re: Rebol API to DyBASE
From: knizhnik:garret:ru at: 17-Dec-2003 20:24
Hello Christian,
Wednesday, December 17, 2003, 7:48:54 PM, you wrote:
>> Compare the following results:
>> Rebol: 18 seconds
CL> h: make hash! 100000
CL> start: now/time/precise
CL> for i 1 100000 1 [ insert tail h i ]
CL> now/time/precise - start
CL> == 0:00:00.25
O, shame on me - I have to guess myself that preallocating hash size
will have such effect. with "make hash! 100000" instead of just
make hash! []
, results at my computer are:
1.1983 seconds with append, 1.151 with "insert tail"
The only justification for my fault is that in ALL other languages I
know, omitting initial hash size parameter has no such dramatical
influence on performance (usually hash size is doubled)
CL> That's 250 msec. Your version runs in about 350 msec.
CL> Since I can't imagine you're running a machine 50 times slower than
CL> mine, there's something seriously weird going on ...
CL> BTW, I still don't quite get why append has to be so much slower than
CL> insert tail. Does anyone have any ideas wrt/ that issue?
It is clear - append is implemented using insert:
append: func [
{Appends a value to the tail of a series and returns the series head.}
series [series! port!]
value
/only "Appends a block value as a block"
][
head either only [
insert/only tail series :value
] [
insert tail series :value
]
]
--
Best regards,
Konstantin mailto:[knizhnik--garret--ru]