How to make regexes faster? (Python v. OmniMark)

Peter Hansen peter at engcorp.com
Thu Apr 18 23:39:20 EDT 2002


"Frederick H. Bartlett" wrote:
> 
> I was recently introduced to OmniMark. One of our exercises was to take
> a plain text file of Hamlet and convert it to SGML.
> 
> So I did it in Python, too. But the best time I could get from Python
> was .57 sec, while OmniMark came in at .20 sec. What's the most
> efficient technique for Pythonesque regex-based text processing?

Hmmm... how fast do you need it to be?  Sounds to me like 0.57 seconds
is pretty darned fast.

Do you have specific goals, or are you just on a search for 
something faster?  Remember, "better is the enemy of good"
and the grass is always greener.

(See http://www.seds.org/~chrisl/akin.html )

-Peter



More information about the Python-list mailing list