Skip to content

Instantly share code, notes, and snippets.

@thomwolf
Created June 4, 2018 08:31
Show Gist options
  • Save thomwolf/47520f51380e8a57f078f44bf79c8e53 to your computer and use it in GitHub Desktop.
Save thomwolf/47520f51380e8a57f078f44bf79c8e53 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