Straw poll on Python performance (was Re: Python is far from a top performer ...)

Brian Kelley bkelley at
Sat Jan 10 05:19:38 CET 2004

> This is my "straw poll" question:
>   Do you spend a "significant" amount of time actually optimizing your 
>   Python applications?  (Significant is here defined as "more than five
>   percent of your time", which is for example two hours a week in a 
>   40-hour work week.)

Yes and No :)  I find that optimizing algorithms is a lot more 
beneficial than optimizing code.  Let me give a small example.  I have 
written a chemoinformatics engine ( and 
one of it's features is substructure searching.  That is finding if a 
graph is embedded in another graph.  This is an NP-Complete problem.  A 
company recently compared their technique in terms of speed and 
correctness to frowns.  According to them, frowns was 99% percent 
correct but 1000x slower.  (Why they were marketing their system which 
was built over 5+ man years against mine which was built over 3 months I 
never will understand)

Now, 1000x is a *lot* slower.  However, when used in practice in a 
database setting, my system has a quick mechanism that can reject false 
matches very quickly.  This is standard practice for chemistry databases 
by the way.  All of a sudden the 1000x difference becomes almost 
meaningless.  For a given search across 300000+ compounds, my system 
takes 1.2 seconds and their's takes 25 minutes.  Using my prefiltering 
scheme their system takes 0.7 seconds.  Now my code didn't change at 
all, only the way it was used changed.

I could, of course, generate an example that takes me much longer but 
the average case is a whole lot better.  My system is free though, so my 
users tend not to mind (or quite honestly, expect) as much :)


More information about the Python-list mailing list