Version 8 (modified by 15 years ago) ( diff ) | ,
---|
Optimisation
Writing code which runs fast.
Consider having configurations which are read from DB frequently but written-to rarely, be set in configuration files which are written-out from the DB (like the CSS from themes)
- http://wiki.python.org/moin/PythonSpeed/PerformanceTips#Loops
- http://www.python.org/doc/essays/list2str/
- http://www.skymind.com/~ocrow/python_string/
- http://diveintopython.org/performance_tuning/index.html
- If a specific inner-loop routine canot be optimised in Python, then consider writing a C routine for this use case.
for i in range(0, len(rows)): row=rows[i]
runs much faster than:
for row in rows:
(0.05 vs. 0.001 seconds in my test case).
Profiling
- http://www.cherrypy.org/wiki/Testing#Profiling
- http://mg.pov.lt/profilehooks/
- YSlow plugin for Firebug: http://developer.yahoo.com/yslow/
Note:
See TracWiki
for help on using the wiki.