Hi list,

far from being a parse guru, but here's a bit more hopefully optimised 
and easier version :-)

speedtest: func [][
   st: now/precise
   loop 10000 [
     teststring: copy "I'm so not here"
     stripped: trim/with teststring "' "
   ]
   et: now/precise
   print ["10000 trim/with took:" difference et st]
   st: now/precise
   strip: charset [#" " #"'"]
   loop 10000 [
     teststring: copy "I'm so not here"
     parse/all teststring [any [here: strip (remove here) | skip]]
   ]
   et: now/precise
   print ["10000 parse took:" difference et st]
]

->> speedtest
10000 trim/with took: 0:00:00.018
10000 parse took: 0:00:00.046


PS: without the /all refinement, spaces were not even considered .... 
however - by consecutively running speedtest, result times jump here and 
there ...

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

Reply via email to