User:Ajak/Portage Performance

= Portage performance notes =

I've noticed some odd things with regard to Portage performance. I'm documenting them here so I have a public way to reference them.

Note that different baseline timings between different hyperfine runs aren't relevant, such timings are highly variable based on the state of the system at the time. A quicker dependency calculation might mean that the world update is clean, for example, while a longer emerge run might mean there's many things to update. It's worth exploring exactly where that time might be lost as an indication of what dependency tree state might trigger longer runtimes. For timing comparisons between emerge runs on the same system state, this should not matter much.

cpython vs pypy
mgorny has noticed that pypy3 is much faster for dependency calculations (for him). In his blog post, he notes that many people were not able to reproduce his results. I surmise that much of this is due to few people realizing that  drastically affects pypy performance. With that flag on, Portage compiles C extensions, while pypy.org's performance page notes, "Any C extension module recompiled with PyPy takes a very large hit in performance. PyPy supports C extension modules solely to provide basic functionality."

Once I turn that flag off, I can indeed produce a similar speedup:

However, even with this change, some people still report no significant change between cpython and pypy.

Anecdotally, I've noticed that package merges are much slower with pypy3 (as opposed to just dependency calculations as above). I haven't found a package with which I can reproducibly demonstrate the performance difference.

python3.10 vs python3.11
Over the recent months, it's been asked many times whether the upstream speedups with python3.11 do anything substantial with Portage. I don't think so:

Comparing runtime of Github Actions CI for python3.10 vs python3.11 shows a similar result, even if it isn't a proper benchmark.