
-----------------------------------
apython1992
Mon Mar 21, 2011 12:30 pm

Python Performance Tips
-----------------------------------
In another topic on these forums a few members started wondering which looping techniques in Python result in the fastest execution, and I was pretty curious about the verdict - you can use mapping, list comprehensions, explicit for loops, and others too.  I found this resource on the web that documents an in-depth study on this matter:
http://www.python.org/doc/essays/list2str.html

If you're looking for ways to make your code much faster, take a look at that study. I find it incredibly useful.  Also, since there's obviously more to optimizing code than just figuring out the best looping constructs, I found a page written by some of the Python guys themselves detailing a number of tips on writing the most efficient code, exploring other issues like dots, sorting, local variables, and more.  I feel like this would be a really handy resource for Pythoneers who are worried about writing high-performance code:
http://wiki.python.org/moin/PythonSpeed/PerformanceTips

Happy optimizing!

-----------------------------------
SNIPERDUDE
Mon Mar 21, 2011 1:41 pm

RE:Python Performance Tips
-----------------------------------
Thanks for the links!

-----------------------------------
apython1992
Mon Mar 21, 2011 1:52 pm

RE:Python Performance Tips
-----------------------------------
You're quite welcome!
