Profiling very small/quick functions, help!?

S

skanemupp

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)")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,265
Latest member
TodLarocca

Latest Threads

Top