foot: Add PGO build option
PGO optimization speed foot up by a significant amount. Add a build option that enables PGO during build.
Definitely not on by default, since PGO is affected by the CPU that's being used.
since PGO is affected by the CPU that's being used.
It's actually not. PGO counts functions and branches executed, and helps re-organize the code; it clusters "hot" functions, to improve cache locality. It can also re-arrange code within a function to make the "normal" path the fast path (i.e. placing the not-often executed branches at e.g. the end of the function). But PGO in itself does not emit CPU specific instructions, nor does it depend on CPU-specific knowledge for e.g. instruction scheduling.
Over at nix, @sternenseemann has been able to do reproducable PGO builds. That is, builds on different systems produce identical output. I can't for my life find the issue, or comment, where I saw this, but pretty sure sterni can fill in the details, if needed.
Oh, and as a bonus, PGO builds tend to be smaller (in binary size) than regular release builds. This is at least true for LTO builds (which I strongly recommend building foot with, with or without PGO).
I can confirm that building foot with PGO can be reproducible, i. e. I can reproduce the exact hash of the binary package produced by our builders on two different local machines (at different times). This also leads me to believe that a reproducible gcc with PGO is possible, but most likely very hard to get to work.
The only thing necessary to achieve a reproducible foot build is generating the random inputs which are used for profiling while building using a fixed seed.
Issues become stale 90 days after last activity and are closed 14 days after that. If this issue is still relevant bump it or assign it.
Not stale. @ifreund do you have anything in effect for this? I think I had a branch attempting it a while back
@ericonr nope, I haven't tried to implement this yet.
Issues become stale 90 days after last activity and are closed 14 days after that. If this issue is still relevant bump it or assign it.