Changes between Version 7 and Version 8 of DeveloperGuidelines/Optimisation


Ignore:
Timestamp:
11/16/09 08:22:33 (15 years ago)
Author:
Fran Boon
Comment:

'for row in rows' slow

Legend:

Unmodified
Added
Removed
Modified
  • DeveloperGuidelines/Optimisation

    v7 v8  
    33Writing code which runs fast.
    44
    5 Consider having configurations which aread from DB frequently but written-to rarely, be set in configuration files which are written-out from the DB (like the CSS from themes)
     5Consider 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)
    66
     7 * http://wiki.python.org/moin/PythonSpeed/PerformanceTips#Loops
    78 * http://www.python.org/doc/essays/list2str/
    89 * http://www.skymind.com/~ocrow/python_string/
    910 * http://diveintopython.org/performance_tuning/index.html
     11 * If a specific inner-loop routine canot be optimised in Python, then consider writing a C routine for this use case.
     12
     13{{{
     14for i in range(0, len(rows)):
     15     row=rows[i]
     16}}}
     17runs much faster than:
     18{{{
     19 for row in rows:
     20}}}
     21(0.05 vs. 0.001 seconds in my test case).
    1022
    1123=== Profiling ===