Skip to content

Instantly share code, notes, and snippets.

@re9ulus
Last active May 21, 2016 20:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save re9ulus/95d390c71a13ba83393fb3a98dd8d6ae to your computer and use it in GitHub Desktop.
Save re9ulus/95d390c71a13ba83393fb3a98dd8d6ae to your computer and use it in GitHub Desktop.
Python profiler example
# cProfile
import cProfile
source = open('path/to/src').read()
cProfile.run(source, sort='tottime)
# Line profiler (using IPython)
%load_ext line_profiler
from mypackage import foo, bar
%lprun -f bar foo()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment