actual time performance measurement

Eric S. Johansson esj at
Tue Jun 29 19:55:23 CEST 2004

more questions about performance measurements in python.  I solve the problems I had with shelf by not using it.  I'm doing a direct pickle to and from file of an entire dictionary.  That knocked off a good third of my CPU time.  there was another big hit that that was quick and easy.  I went from approximately 3.5 seconds down to .5 seconds CPU time.

The problem is, from hitting the submit button to new display, it is taking approximately 23 seconds.  now I have my suspicions as to where the time is going but I know from hard experience that guessing at performance problems is about as productive as guessing at lottery numbers.  I was under the impression from reading the documentation that if I added a different time function, it would switch to measuring elapsed time rather than CPU time consumed by the process.  So I used the following:

import profile
import time
low_profile = profile.Profile(time.time)'main()', '/tmp/correct_cgi')

this is obviously wrong as is not giving me the data I would expect but I'm not able to figure out from the documentation what is the correct way.  I would appreciate a pointer to how to measure performance of an application with respect to user time.  I want to confirm or deny my suspicion is that some external service I'm calling (file system, subprocesses) is causing the performance problems and I want to measure how much time they consume.


More information about the Python-list mailing list