Quickies

[categories] [index] [all (527)] [latest]

Python
  1. Let the profiler execute the code

    import hotshot
    
    prof = hotshot.Profile("hotshot_stats.prof")
    prof.runcall(my_function)
    prof.close()
    

    Display results

    from hotshot import stats
    
    s = stats.load("hotshot_stats.prof")
    s.strip_dirs()
    s.sort_stats('time', 'calls')
    s.print_stats(20)