Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Build using PGO + LTO #5

Open
jamatthews opened this issue Jun 20, 2019 · 3 comments
Open

Build using PGO + LTO #5

jamatthews opened this issue Jun 20, 2019 · 3 comments
Labels
enhancement New feature or request

Comments

@jamatthews
Copy link
Contributor

jamatthews commented Jun 20, 2019

In late 2017 I was investigating building Ruby using Profile Guided Optimization and Link Time Optimization. Python has support for building with PGO + LTO https://bugs.python.org/issue25702 but it's quite brittle. If Fullstaq Ruby standardised on building with a single version of GCC or Clag then it wouldn't be too hard to build using PGO + LTO (just slower) and would produce Ruby binaries which run 3-5% faster.

@FooBarWidget FooBarWidget added the enhancement New feature or request label Jun 20, 2019
@FooBarWidget
Copy link
Collaborator

That is a good idea! With single version of GCC, do you mean a single version across all distributions, or a single version within the context of a single distribution? And where would the profile come from?

@jamatthews
Copy link
Contributor Author

jamatthews commented Jun 20, 2019

I think 2.4+ will all build with a recent version of GCC and there's no reason to build with older compilers anymore. The build process becomes: build instrumented code, run instumented code to generate the profile, build using profile. jamatthews/ruby@4aefb10

The main problem with PGO+LTO is the crazy build times but when distributing binaries it's much less of a problem.

It's a while ago now but I saw some minor improvements of 3-5% just using the tests as a profiling task. I believe CPython uses the tests as the profiling task too. The more general the profiling task, the better. The main benefit comes from the cross-file inling from LTO, inling rb_str_free() etc.

@zamazan4ik
Copy link

(sorry for necroposting) Any news? I am interested to see LTO + PGO in the upstream Ruby project. Starting with LTO is a good point (since it's easier to achieve than PGO).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants