Run, Python, Run
hbfs.wordpress.com
hbfs.wordpress.com
My current setup to profile a python cgi application consists of a set of scripts to mock the cgi runtime, invoke the application with cprofile and accumulate profiling data in a single pstats file. To get a grasp of the hot spots, I'm using the magnificent gprof2dot script (http://code.google.com/p/jrfonseca/wiki/Gprof2Dot) to generate a callgraph with profiling data (example: http://wiki.jrfonseca.googlecode.com/git/gprof2dot.png). Gprof2dot hides all unimportant (by default less than 1% runtime) calls and colors functions according to the time spend executing them. To view absolute numbers, I wrote a small python script to print the first view entries of a pstats file to the terminal and use that with watch (http://linux.die.net/man/1/watch) to keep an eye on absolute runtimes.
Overall this is a nice setup and I'm very impressed by the rich amount tools available for python, though sometimes the APIs are kind of strange to me (for example cProfile, pstats).
also, when you're using a new api, it's worth paying attention to the default arguments for functions. since .pop() has an implicit argument of -1 you shouldn't be surprised that popping from the end of an array is most efficient (this is related to the O(n^2) v O(n) issue mentioned in the article).
(as others have said, they're what you'd expect for an amortized dynamic array that expands proportional to the contents)