Profiling very small/quick functions, help!?

skanemupp at yahoo.se skanemupp at yahoo.se
Wed Apr 16 12:35:17 EDT 2008


i use this code to profile. however for small standard functions it
just says 0 seconds.
so one solution is to run the function a very big number of times(how
big?).
but the bottom code doesnt work, it just runs the same profiling 10000
times insetad of running the fucntion 10K
times and evaluate the time of all thsoe 10K times.

ao how to solve this?

if __name__=="__main__":
    try:
        from cProfile import run
    except:
        from profile import run
    run("tests()")

if __name__=="__main__":
    try:
        from cProfile import run
    except:
        from profile import run
    for x in range(1, 10000):
        run("power(10,10)")



More information about the Python-list mailing list