github.com/krenzlin/pyhamburg-lightweight-profiling
bit.ly/2K3Nixs
Donald E. Knuth (1974): "Computer Programming as an Art"
Programmers waste enormous amounts of time
thinking about, or worrying about,
the speed of noncritical parts of their programs.
__ (1974): "Structured Programming with go to Statements"
$ time python main1.py
$ python -m timeit -s "import lib" "lib.do_stuff()"
or if you know about the internals
$ python -m timeit -s "import lib" "lib.fast()"
$ python -m timeit -s "import lib" "lib.medium()"
$ python -m timeit -s "import lib" "lib.slow()"
$ python -m cProfile -s cumulative main1.py
but overhead
$ time python main1.py
vs.
$ time python -m cProfile -s cumulative main1.py
- trade accuracy for less overhead
python main2.py
- FlameGraph - https://github.com/brendangregg/FlameGraph
$ ./flamegraph.pl profiler.out > graph.svg
- Morikawa, Evan (2016): "Profiling Python in Production" link
- Knuth, Donald E. (1974): "Computer programming as an art" pdf
- Knuth, Donald E. (1974): "Structured Programming with go to Statements" link
- Tornetta, Gabriele N. (2019): "Deterministic and Statistical Python Profiling" https://p403n1x87.github.io/python/profiling/2019/05/05/python-profiling.html