RE: [REBOL] Re: newlines

Hi Ladislav,

yes, i know, i forgot some lines..

a bit dicussion:

- i was surprised to have the fastest algorithm.
i tried to be simple, 
and to reduce the lots of large movements of remove-solutions.

- i think the handling is in response of the user.
'copy yourself if needed is rebol-style..
because often there is something parsed 
and completely handled, before the function is called again.
used that way there is no need to copy the result.
if there is need, [copy INS1 text] is short.

OTOH similar one could claim the remove-solutions destroy the string, 
so they should copy first? ;-)

- instead of post-allocation like [copy out],
i could do [insert clear s out] without allocations.
which may trigger some gc when lots of 
benchmark-loops.
could you benchmark this two solutions too please?

-Volker

-
[EMAIL PROTECTED] wrote:
> 
> Hi Joel, Volker & all,
> 
> I would like to comment the speed of the INS1 algorithm:
> 
> <<
>         out: clear ""
>         parse/all s [
>             any [
>                 start: thru "..." end1: any "." (
>                     insert/part tail out start back end1
>                 )
>             ]
>         ]
>         insert tail out start
>         out
> >>
> 
> The way the algorithm is designed gives it an unfair advantage when it is
> timed in a loop where it is executed more than once. To receive a fair value
> for one pass, we would have to modify the first line as follows:
> 
>     out: copy ""
> 
> Then the algorithm would be slower than its preallocated variant, which is:
> 
>     out: make string! length? s
> 
> Even the preallocated variant is slower than the "artificial" variant used
> if the speed is measured executing the code in a loop as described.
> 
> That is why I think, that the results for this algorithm are "less valid"
> than the results of other algorithms in this arrangement.
> 
> Cheers
>     Ladislav
> 
> -- 
> To unsubscribe from this list, please send an email to
> [EMAIL PROTECTED] with "unsubscribe" in the 
> subject, without the quotes.
> 
-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.

Reply via email to