Skip to content

Instantly share code, notes, and snippets.

@tadzik
Last active August 29, 2015 14:11
Show Gist options
  • Save tadzik/dca1e4fd175a04f7de3a to your computer and use it in GitHub Desktop.
Save tadzik/dca1e4fd175a04f7de3a to your computer and use it in GitHub Desktop.
4018 function calls in 0.003 seconds
Ordered by: cumulative time
ncalls tottime percall cumtime percall filename:lineno(function)
1000 0.002 0.000 0.002 0.000 /usr/lib/python2.7/urlparse.py:95(hostname)
1002 0.000 0.000 0.000 0.000 {method 'split' of 'str' objects}
1001 0.000 0.000 0.000 0.000 {method 'lower' of 'str' objects}
1000 0.000 0.000 0.000 0.000 {method 'append' of 'list' objects}
1 0.000 0.000 0.000 0.000 /usr/lib/python2.7/urlparse.py:168(urlsplit)
1 0.000 0.000 0.000 0.000 <string>:8(__new__)
1 0.000 0.000 0.000 0.000 /usr/lib/python2.7/urlparse.py:160(_splitnetloc)
3 0.000 0.000 0.000 0.000 {min}
1 0.000 0.000 0.000 0.000 {method 'get' of 'dict' objects}
1 0.000 0.000 0.000 0.000 {built-in method __new__ of type object at 0x93b580}
4 0.000 0.000 0.000 0.000 {method 'find' of 'str' objects}
2 0.000 0.000 0.000 0.000 {len}
1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
from urlparse import urlsplit
import cProfile, pstats
pr = cProfile.Profile()
pr.enable()
u = urlsplit("http://www.google.com/foo/bar?argh=fuuu#baz")
a = []
for i in xrange(1000):
a.append(u.hostname)
pr.disable()
ps = pstats.Stats(pr).sort_stats('cumulative')
ps.print_stats()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment