Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

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

Closed
zamazan4ik opened this issue Nov 15, 2023 · 3 comments
Labels
compiler Changes related to the compiler feature New things to add to Inko, such as a new standard library module performance Changes related to improving performance runtime Changes related to the Rust-based runtime library

Comments

@zamazan4ik
Copy link

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:

  • Evaluate PGO's applicability to Inko tooling.
  • If PGO helps to achieve better performance - add a note to Inko's documentation about that. In this case, users and maintainers will be aware of another optimization opportunity for Inko tools.
  • Provide PGO integration into the build scripts. It can help users and maintainers easily apply PGO for their workloads.
  • Optimize prebuilt binaries with PGO.

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 #650 . In #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.

@zamazan4ik zamazan4ik added the feature New things to add to Inko, such as a new standard library module label Nov 15, 2023
@yorickpeterse yorickpeterse added performance Changes related to improving performance compiler Changes related to the compiler runtime Changes related to the Rust-based runtime library labels Nov 15, 2023
@yorickpeterse
Copy link
Collaborator

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
Copy link
Author

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.

@yorickpeterse yorickpeterse added this to the Future ideas milestone Dec 24, 2023
@yorickpeterse yorickpeterse removed this from the Future ideas milestone Aug 5, 2024
@yorickpeterse
Copy link
Collaborator

We're not going to host any PGO data any time soon, nor will we start hosting binaries. This means it's up to end users/packagers to apply PGO data.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
compiler Changes related to the compiler feature New things to add to Inko, such as a new standard library module performance Changes related to improving performance runtime Changes related to the Rust-based runtime library
Projects
None yet
Development

No branches or pull requests

2 participants