inko-lang / inko

A language for building concurrent software with confidence
http://inko-lang.org/
Mozilla Public License 2.0
812 stars 38 forks source link

Evaluate using Profile-Guided Optimization (PGO) and Post Link Optimization (PLO) for the Inko tooling ecosystem #651

Open zamazan4ik opened 7 months ago

zamazan4ik commented 7 months ago

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:

Some 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.

yorickpeterse commented 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).

zamazan4ik commented 7 months ago

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.