Skip to content

Instantly share code, notes, and snippets.

@re9ulus re9ulus/profile_example.py
Last active May 21, 2016

Embed
What would you like to do?
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
You can’t perform that action at this time.