Peter

Trim modifies the string in situ.

Your trim code only does it once but parse is working 10,000 x.

On Wed, Oct 7, 2009 at 6:51 PM, Peter Wood <[email protected]> wrote:
> 2009/10/7 Izkata <[email protected]>
>
>>
>> If all you're doing is stripping characters, I suggest 'trim -
>>
>> >> trim/with {I'm so not here} {' }
>> =3D3D=3D3D "Imsonothere"
>>
>> Is parse faster in this case?
>>
>>
> Trim is much faster than parse for your example. It is a native function.
> speedtest: func [][
> =A0 =A0st: now/precise
> =A0 =A0loop 10000 [stripped: trim/with teststring "' "]
> =A0 =A0et: now/precise
> =A0 =A0print ["10000 trim/with took:" difference et st]
> =A0 =A0st: now/precise
> =A0 =A0strip: charset [#" " #"'"]
> =A0 =A0not-strip: complement strip
> =A0 =A0loop 10000 [
> =A0 =A0 =A0 =A0stripped: copy ""
> =A0 =A0 =A0 =A0parse teststring [any [copy str some not-strip (insert tai=
l stripped
> str) | some strip]]
> =A0 =A0]
> =A0 =A0et: now/precise
> =A0 =A0print ["10000 parse took:" difference et st]
> ]
>
>>> speedtest
> 10000 trim/with took: 0:00:00.007205
> 10000 parse took: 0:00:00.05729
>
> Regards
> Peter
>
>
> --
> To unsubscribe from the list, just send an email to
> lists at rebol.com with unsubscribe as the subject.
>
>



--=20
Graham Chiu
http://www.synapsedirect.com
Synapse - the use from anywhere EMR.
-- 
To unsubscribe from the list, just send an email to 
lists at rebol.com with unsubscribe as the subject.

Reply via email to