2009/10/7 Izkata <[email protected]>

>
> If all you're doing is stripping characters, I suggest 'trim -
>
> >> trim/with {I'm so not here} {' }
> =3D=3D "Imsonothere"
>
> Is parse faster in this case?
>
>
Trim is much faster than parse for your example. It is a native function.
speedtest: func [][
    st: now/precise
    loop 10000 [stripped: trim/with teststring "' "]
    et: now/precise
    print ["10000 trim/with took:" difference et st]
    st: now/precise
    strip: charset [#" " #"'"]
    not-strip: complement strip
    loop 10000 [
        stripped: copy ""
        parse teststring [any [copy str some not-strip (insert tail stripped
str) | some strip]]
    ]
    et: now/precise
    print ["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.

Reply via email to