Skip to content

Instantly share code, notes, and snippets.

@tuturto
Created November 1, 2016 11:11
Show Gist options
  • Save tuturto/54d7d9ad289a6e08499f29b947557a5b to your computer and use it in GitHub Desktop.
Save tuturto/54d7d9ad289a6e08499f29b947557a5b to your computer and use it in GitHub Desktop.
=> (defn foo [a b]
... (if (< a 1)
... b
... (foo (dec a) (inc b))))
=> (foo 100 1)
101
=> (require hy.contrib.profile)
=> (profile/cpu (foo 100 1))
101
<pstats.Stats object at 0xb6a475ec>
1502 function calls (1402 primitive calls) in 0.006 seconds
Random listing order was used
ncalls tottime percall cumtime percall filename:lineno(function)
200 0.000 0.000 0.000 0.000 /home/tuukka/programming/python/virtualenvs/pyherc/lib/python3.4/_weakrefset.py:70(__contains__)
200 0.001 0.000 0.004 0.000 /home/tuukka/programming/python/virtualenvs/pyherc/lib/python3.4/site-packages/hy/core/language.hy:299(is_numeric)
200 0.001 0.000 0.003 0.000 /home/tuukka/programming/python/virtualenvs/pyherc/lib/python3.4/site-packages/hy/core/language.hy:206(is_instance)
200 0.001 0.000 0.004 0.000 /home/tuukka/programming/python/virtualenvs/pyherc/lib/python3.4/site-packages/hy/core/language.hy:36(_numeric_check)
101/1 0.001 0.000 0.006 0.006 <input>:1(foo)
100 0.000 0.000 0.003 0.000 /home/tuukka/programming/python/virtualenvs/pyherc/lib/python3.4/site-packages/hy/core/language.hy:61(dec)
200 0.001 0.000 0.002 0.000 {built-in method isinstance}
100 0.000 0.000 0.002 0.000 /home/tuukka/programming/python/virtualenvs/pyherc/lib/python3.4/site-packages/hy/core/language.hy:201(inc)
1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
200 0.001 0.000 0.001 0.000 /home/tuukka/programming/python/virtualenvs/pyherc/lib/python3.4/abc.py:178(__instancecheck__)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment