Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions arrow/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,3 +167,26 @@ For a full list of features and target CPUs use
$ rustc --print target-cpus
$ rustc --print target-features
```

### Profile-Guided Optimization

Profile-Guided Optimization (PGO) can also help. It builds your application twice. The first
build is instrumented, and running it on a typical workload records which code paths are hot.
The second build uses that profile, so the compiler optimizes for the paths your workload
actually takes. PGO is set up in the build of your final binary, not in `arrow` itself.

A [PGO benchmark report](https://github.com/apache/arrow-rs/discussions/6500) for this crate
found that many `arrow` benchmarks got faster and some got slower, so measure it on your own
workload before relying on it.

[cargo-pgo](https://github.com/Kobzol/cargo-pgo) runs these steps for you:

```shell
$ rustup component add llvm-tools-preview
$ cargo install cargo-pgo
$ cargo pgo build # instrumented build, then run the binary on your workload
$ cargo pgo optimize # rebuild with the recorded profile
```

The [rustc book](https://doc.rust-lang.org/rustc/profile-guided-optimization.html) shows how to
do the same with the `-Cprofile-generate` and `-Cprofile-use` flags.