Regex Speed

Pop User popuser at christest2.dc.k12us.com
Wed Feb 21 12:27:23 EST 2007


John Machin wrote:
> Or a Glushkov NFA simulated by bit parallelism re module ... see
> http://citeseer.ist.psu.edu/551772.html
> (which Russ Cox (author of the paper you cited) seems not to have
> read).
>   
NR-grep looks interesting, I'll read that. Thanks.
> Cox uses a "pathological regex" (regex = "a?" * 29 + "a" * 29, in
> Python code) to make his point: grep uses a Thompson gadget and takes
> linear time, while Python perl and friends use backtracking and go off
> the planet.
>
>   
It might be pathological but based on the original posters timings his 
situation seems to relate.
My main point was that its quite possible he isn't going to get faster 
than grep regardless of
the language he uses and if grep wins, use it.  I frequently do. 

> Getting back to the "It would be nice ..." bit: yes, it would be nice
> to have even more smarts in re, but who's going to do it? It's not a
> "rainy Sunday afternoon" job :
One of these days.  :)






More information about the Python-list mailing list