visualising python profiles with flameprof
https://github.com/baverman/flameprof/ is a great single-file converter from python’s profile file format to SVG flamegraphs.
emerge is known to be slow occasionally. I always wondered why exactly but could never quite get to it.
Example ebuild for Gentoo is here.
Let’s grab the profile:
$ cd ~/dev/git/portage $ python -m cProfile -o emerge.prof \ \ ./bin/emerge -pvuDN @world @preserved-rebuild --with-bdeps=y --complete-graph \ --changed-deps --verbose-conflicts --backtrack=10000 # wait 5 minutes ^Ctrl-C Exiting on signal Signals.SIGINT
$ flameprof emerge.prof > emerge.svg
Generated profile graph is here.
If you spot something odd you can try to tweak it! I’ll try as well.