On May 7, 12:20 pm, Alberto Valverde <[EMAIL PROTECTED]> wrote:
> BTW: Thanks for the detailed profile stats analysis! Very
> enlightening... Any pointers to good reads for further learning?

http://wiki.python.org/moin/PythonSpeed

But there are a few additional things I have learned while developing
CherryPy and Dejavu:

 * Benchmark your code. Distribute a benchmark with your code if you
can. Use it to pinpoint what changesets caused slowdowns.
 * Profile your code. Distribute a profiler with your code if you can.
 * Trace your code (with pdb or PyConquer [1]); the profiler output
only goes so far, since it is a summary of call behavior.
 * Attack the largest potential benefits first; work your way from
biggest bottleneck down.
 * Make those who need extra functionality pay for it (instead of
making everyone pay). For example, every CP 2 filter made everyone pay
a performance penalty whether they had it turned on or not; CP 3
tools, in contrast, have no cost if you don't use them. Be religious
about what "extra functionality" really means (more than you think).
 * Pure-Python modules from the standard library are almost always
more general-purpose than you need them to be. Rewrite them from
scratch (if profiling dictates!). For example, CP's wsgiserver saw a
big speedup (10%+ overall) by ditching the builtin mimetools module
when reading request headers, and inlining HTTP-specific header logic.


Robert Brewer
System Architect
Amor Ministries
[EMAIL PROTECTED]

[1] http://projects.amor.org/misc/wiki/PyConquer


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to