docs: add Profile-Guided Optimization note to arrow Performance Tips - #10769
Open
s1amese2003 wants to merge 1 commit into
Open
docs: add Profile-Guided Optimization note to arrow Performance Tips#10769s1amese2003 wants to merge 1 commit into
s1amese2003 wants to merge 1 commit into
Conversation
PGO is measured against this crate's benchmarks in discussion apache#6500 but is mentioned nowhere in the repository. Document it alongside the existing `-C target-cpu` advice in arrow/README.md, since both are build-time knobs for applications that depend on `arrow` rather than changes to the crate. Includes the caveat from apache#6500 that the report measured both improvements and regressions, so the benefit depends on how representative the training workload is.
s1amese2003
force-pushed
the
docs-pgo-performance-tips
branch
from
August 20, 2026 13:52
ea18d96 to
f30d54e
Compare
Rich-T-kid
approved these changes
Aug 20, 2026
Rich-T-kid
left a comment
Contributor
There was a problem hiding this comment.
neat PR, thank you for adding it.
Comment on lines
+185
to
+189
| The compiler chooses what to inline and how to lay out branches without knowing | ||
| which paths a workload actually takes. [Profile-Guided Optimization] (PGO) | ||
| records a profile from a representative run and feeds it back into a second | ||
| compilation, so that those decisions are driven by measured behaviour rather | ||
| than by heuristics. |
Contributor
There was a problem hiding this comment.
wow I didn't even know this was a thing
|
|
||
| [Profile-Guided Optimization]: https://doc.rust-lang.org/rustc/profile-guided-optimization.html | ||
| [`cargo-pgo`]: https://github.com/Kobzol/cargo-pgo | ||
| [PGO benchmark report]: https://github.com/apache/arrow-rs/discussions/6500 |
Contributor
There was a problem hiding this comment.
nit: I don't think we need to link back to the discussion
Author
There was a problem hiding this comment.
Thanks for the review!
I'd rather keep this one if you don't feel strongly — the sentence makes a specific claim (improvements on some benchmarks, regressions on others) and the link is the evidence for it. Happy to drop it if you still think it's noise.
Contributor
There was a problem hiding this comment.
makes sense to me, i don't feel too strongly either way
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Rationale for this change
The PGO benchmark report in #6500 measured Profile-Guided Optimization against this crate's own benchmarks and found it can be a worthwhile win for downstream applications, but PGO is currently mentioned nowhere in the repository, so there is no way to discover it from the documentation.
arrow/README.mdalready ends with a "Performance Tips" section covering the other build-time knob users are expected to reach for (-C target-cpu). PGO belongs in the same place: liketarget-cpu, it is advice for someone compiling an application that depends onarrow, not a change to the crate itself.What changes are included in this PR?
A
### Profile-Guided Optimizationsubsection appended to the existing "Performance Tips" section ofarrow/README.md, covering:arrowis a library and the profile has to come from the application's own workloadcargo-pgocommand sequence, and the-C profile-generate/-C profile-useflags it wrapsDocumentation only; no code changes.
Are these changes tested?
There is no test for a README, but rather than transcribing the commands from cargo-pgo's own documentation I ran them against this repository in a clean
rust:1-slim-bookwormcontainer:rustup component add llvm-tools-preview,cargo pgo inforeportsllvm-profdatafound-p arrow --example builders:cargo pgo buildproduced an instrumented binary, running it wrote a profile intotarget/pgo-profiles/, andcargo pgo optimizerebuilt from that profile. cargo-pgo's own output prints the same binary location the snippet describes.PGO profile data was not found for 39620 functions, which is what you would expect when the training run only touches a small part of the crate, and is the concrete reason the last paragraph tells readers the training workload has to be representative.arrow-cast'sparse_timebenchmark reported improvements of 3.2%-9.5% (criterion, p < 0.05) against a release baseline saved with--save-baseline. That was measured in a container on a virtualised host with no CPU pinning or frequency control, so I would treat the direction as meaningful and the magnitudes as indicative only. Profile-Guided Optimization (PGO) benchmark report #6500 remains the authoritative measurement.Are there any user-facing changes?
arrow/README.mdis user-facing documentation, so yes in that sense. There are no API changes.AI disclosure
I used an AI assistant to help draft the wording of this section and to run the verification steps described above. I have reviewed every line, and the placement, the command sequence, and the caveat all follow from the verification above rather than from unchecked generated text.