Skip to main content

Adding Profile-Guided Optimization (PGO) to the R interpreter

Created
Active
Viewed 446 times
2 replies
4

Recently I did many Profile-Guided Optimization (PGO) benchmarks on multiple projects (including interpreters and compilers like CPython, Rustc, Clang, Clangd, Clang Tidy, and many others) - the results are available here. I guess enabling the R interpreter would be a good option for the users since it can bring additional performance.

I can suggest the following things to do:

  • Evaluate PGO's applicability to the R interpreter with some benchmarks.

  • If PGO helps to achieve better performance - add a note to R's documentation about that. In this case, users and maintainers will be aware of another optimization opportunity for the R interpreter.

  • Provide PGO integration into the build scripts. It can help users and maintainers easily apply PGO on the R interpreter for their workloads.

  • Optimize pre-built 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). This optimization technique is already integrated into the Clang, CPython, and Rustc build scripts. But I suggest starting with PGO - it's a more stable optimization than PLO in the general case.

P.S. Previously this was created as a https://stackoverflow.com/questions/77512986/adding-profile-guided-optimization-pgo-to-the-r-interpreter, but as people stated, the Stack Overflow's Discussions space is more suitable for this topic.

2 replies

Sorted by:
77526268
5

Both locations are wrong / ineffective. The only place that matters for these types of proposals is the r-devel mailing list. Simply enumerating other projects where this helped may not buy you much but may you could try to apply it to (maybe just a part of) the R sources and see what happens?

77533977
1

Okay, I just created the discussion on SO because it was proposed by a person in the original issue. If you think that the mailing list is a more efficient way to discuss such questions - good, I'm fine with moving to the mailing list.

I list similar projects just to encourage people to give a try to the PGO since it works in many other projects and it's much easier for me to show them before investing more time into the actual optimization steps for the R interpreter.

Before applying PGO to the R interpreter. Is there an R interpreter bench suite or something like that? Using ready-to-use and verified benchmarks is much easier to do instead of crafting a proper benchmark and only then trying to optimize the R interpreter. I am talking about something like https://github.com/python/pyperformance but for R.