Skip to content

Instantly share code, notes, and snippets.

@planetceres
Forked from thomwolf/profile.py
Created October 31, 2018 18:46
Show Gist options
  • Save planetceres/28cc663948bcd11f3f502aadf5c02893 to your computer and use it in GitHub Desktop.
Save planetceres/28cc663948bcd11f3f502aadf5c02893 to your computer and use it in GitHub Desktop.
Profiling a Python module
import cProfile
import pstats
import my_slow_module
cProfile.run('my_slow_module.run()', 'restats')
p = pstats.Stats('restats')
p.sort_stats('cumulative').print_stats(30)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment