minutely faster than trim/with

digit: charset "0123456789"
noise: complement digit
start: now/time/precise
rule: [digit | here: some noise there:(remove/part :here :there) :here]
loop 1'000'000 [parse/all "(250) 764-0929"[some rule]]
now/time/precise - start



Tom wrote:
> that is what I was seeing as well
> 
> Prkr's can be speeded up with bitsets ...
> 
> filter: charset "0123456789"
> start: now/time/precise
> loop 1'000'000 [remove-each char "(250) 764-0929" [not find filter char]]
> now/time/precise - start
> 
> 
> parse with integers! was faster than remove-each but slower than trim
> the trouble of including parse is you have to so something with the 
> results and that is not being done in these  speed tests so it is not 
> really a fair comparison
> 
> rule: [copy num integer!(something num) | skip]
> start: now/time/precise
> loop 1'000'000 [parse/all "(250) 764-0929"[some rule]]
> now/time/precise - start
> 
> a better picture of what the data is really like, where is coming from 
> going to ... would help
> 
> 
> Carl Read wrote:
>> 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