Open zamazan4ik opened 7 months ago
PGO is something that indeed can be useful at some point in the future, though it will likely also require us to host pre-built binaries so others can take advantage of it (e.g. Linux distributions aren't going to run PGO while building I think).
though it will likely also require us to host pre-built binaries so others can take advantage of it (e.g. Linux distributions aren't going to run PGO while building I think).
Not, that it's not a mandatory requirement :) Users can benefit from having PGO too since some people rebuild binary for their localhost machines (Gentoo-style, you know). Somewhere rebuilding is a mandatory requirement (usually due to some security policies).
Regarding Linux distributions - PGO is often used in Linux-based repositories too. GCC, Clang, CPython, Chromium, Firefox - are the most popular packages with enabled PGO in the Linux repositories.
For all of these use-cases having an ability to easily enable PGO - is a very nice feature to have.
Description
Recently I did many Profile-Guided Optimization (PGO) benchmarks on multiple projects (including static analysis tools and compilers like Rustc, Clang, Clangd, Clang Tidy, and many others) - the results are available here. I think it's worth trying to apply PGO to the Inko tooling ecosystem like the compiler (and maybe something else like code formatters, LSP server, etc.).
I can suggest the following things to do:
Here are some examples of how PGO is already integrated into other projects' build scripts:
configure
scriptSome PGO documentation examples in various projects:
After PGO, I can suggest evaluating LLVM BOLT as an additional optimization step after PGO - Post Link Optimization (PLO). But I suggest starting with PGO - it's a more stable optimization than PLO in the general case.
For the Rust projects, I recommend starting with cargo-pgo.
Related work
The issue is not the same as https://github.com/inko-lang/inko/issues/650 . In https://github.com/inko-lang/inko/issues/650 I propose to add a possibility to compile Inko programs with PGO. In this issue, I suggest compiling Inko tools like the compiler with PGO and PLO.