On Saturday, 22-September-2007 at 14:17:45 Petr Krenzelok wrote,

>
>Hi,
>
>well, as with REBOL, another, totally different aproach, the short one :-)
>
>start: now/time/precise
>loop 1'000'000 [remove-each val "1234a5b6v77" [any [val < #"0"  val > #"9"]]]
>now/time/precise - start
>
>== 0:00:06.255
>
>But - parse is usually the fastest method, otoh remove-each is native, 
>it could compare rather well. Parse is more flexible for more 
>complicated set-ups though ...

Being native's the reason I thought of using trim too - and with good reason, 
it seems...

The script...

-----------------

rebol []

print "remove-each..."
start: now/time/precise
loop 1'000'000 [remove-each val "1234a5b6v77" [any [val < #"0"  val > #"9"]]]
print now/time/precise - start

print "trim/with..."
chrs: ""
repeat n 256 [append chrs to-char n - 1]
chrs: exclude chrs "1234567890"
start: now/time/precise
loop 1'000'000 [trim/with "1234a5b6v77" chrs]
print now/time/precise - start

-----------------

And the results...

>> do %/c/program%20files/rebol/view/test.r
Script: "Untitled" (none)
remove-each...
0:00:07.313
trim/with...
0:00:02.343

Now if onlt trim worked as expected!  (Someone else can add the parse test...  
And Kai, like to give us some real-world results?)

-- Carl Read.

-- 
To unsubscribe from the list, just send an email to 
lists at rebol.com with unsubscribe as the subject.

Reply via email to