> terribly slow. Doclifter itself take around a second to parse the troff
> file, but my few lines of code take 25 seconds to parse the resultant
> xml. I've pasted the code at http://pastebin.ca/166941 and I'd like to
> hear from you how I could possibly optimize it.
Hi Tiago,
Before we go any further: have you run your program through the Python
profiler yet?
Take a look at:
http://docs.python.org/lib/profile.html
and see if that can help isolate the slow sections in your program.
If I really had to guess, without profiling information, I'd take a very
close look at the characters() method: it's doing some string
concatentation there that may have very bad performance, depending on the
input. See:
http://mail.python.org/pipermail/tutor/2004-August/031568.html
and the thread around that time for details on why string concatentation
should be treated carefully.
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor