Performance

Note

This page is a stub. This page presently only has reusable snippets.

CPU profiling

For example:

cat packages.json | python -m cProfile -o code.prof ocdskit/__main__.py compile > /dev/null
gprof2dot -f pstats code.prof | dot -Tpng -o output.png
open output.png

To see where a running program is spending its time, use py-spy top.

Memory profiling

For example:

pip install memory_profiler matplotlib
time mprof run libcoveoc4ids data.json
mprof plot

Reference