Skip to content

Instantly share code, notes, and snippets.

@candale
Created April 18, 2016 08:47
Show Gist options
  • Save candale/4ce63979d74f9d933105e3510856bb7f to your computer and use it in GitHub Desktop.
Save candale/4ce63979d74f9d933105e3510856bb7f to your computer and use it in GitHub Desktop.
import pprofile
profiler = pprofile.Profile()
profiler.enable()
# Your slow code here
profiler.disable()
with open('/some/path/to/profile.prof', 'w') as file_:
profiler.callgrind(file_)
# Then used KCachegrind to open the file and check out the goodness
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment