On Jan 11, 11:20 am, Jeremy <jlcon...@gmail.com> wrote: > I just profiled one of my Python scripts and discovered that >99% of > the time was spent in > > {built-in method sub} > > What is this function and is there a way to optimize it?
I'm guessing this is re.sub (or, more likely, a method sub of an internal object that is called by re.sub). If all your script does is to make a bunch of regexp substitutions, then spending 99% of the time in this function might be reasonable. Optimize your regexps to improve performance. (We can help you if you care to share any.) If my guess is wrong, you'll have to be more specific about what your sctipt does, and maybe share the profile printout or something. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list