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:
Rustc: a CI script for the multi-stage build
GCC:
Clang: Docs
Python:
Go: Bash script
V8: Bazel flag
ChakraCore: Scripts
Chromium: Script
Firefox: Docs
- Thunderbird has PGO support too
PHP - Makefile command and old Centminmod scripts
MySQL: CMake script
YugabyteDB: GitHub commit
FoundationDB: Script
Zstd: Makefile
Windows Terminal: GitHub PR
Pydantic-core: GitHub PR
Some PGO documentation examples in various projects:
ClickHouse: https://clickhouse.com/docs/en/operations/optimizing-performance/profile-guided-optimization
Databend: https://databend.rs/doc/contributing/pgo
Nebula: https://docs.nebula-graph.io/3.5.0/8.service-tuning/enable_autofdo_for_nebulagraph/
GCC: Official docs, section "Building with profile feedback" (even AutoFDO build is supported)
Clang:
tsv-utils: https://github.com/eBay/tsv-utils/blob/master/docs/BuildingWithLTO.md
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.