[REBOL] Re: newlines
From: nitsch-lists:netcologne at: 14-Nov-2001 9:14
RE: [REBOL] Re: newlines
Hi Joel, Ladislav,
keep in mind not to trigger unfair gc's because of a
non-real-world amount of loops and therefore garbage.
it looks the most time competing algorithm at 10000
slows down heavily with 30000 without good reason.
it uses parse too, but with copy instead of markers,
so it produces more garbage. could go over a limit
with 30000 so it starts triggering gc's.
so benchmarking with different loop-counts
(=different amount of garbage) is a good idea.
also use a reasonable amout of pre-alocation, like
out: make string! 50000 without producing garbage..
wrong pre-allocation slows down heavy, AFAIK a bug..
i doubt you will see a slowdown by a single
allocation, even if large.
btw you know the trick of using[out: clear [] ] for static buffers
and using [return copy out]?
Gabriele noted it while ago, pretty for self-adjusting
programms.
after you have done this, switch to garbage-free
[insert clear s out]
which copies the result back to the input string,
instead of allocating something.
this should run at native speed.
IIRC there was no notable slowdown, but i benchmarked
a bit lazy.
as i said, i was not aware of having the fastest
looking algorithm..
-Volker
[joel--neely--fedex--com] wrote: