Use the timeit module.
Write the python script to be executed and the number of executions in the timeit method.
s = '''
print "hogheoge"
'''
timeit.timeit(stmt=s, number=10000)
The result is returned in seconds.
0.12250304222106934
If you are looking for a bottleneck across multiple modules, it seems better to use Profiler. I'm doing it with the feeling of roughly hitting with the profiler → checking the function group with timeit
→ improving.
Recommended Posts