cargo-pgo icon indicating copy to clipboard operation
cargo-pgo copied to clipboard

what kind of optimizations can it do?

Open cztomsik opened this issue 5 years ago • 1 comments

I'm curious if it can for example reduce vtable cost?

I want to write my code using dyn traits even if there is only one implementation used actually (alternate impl for tests) but I also don't want to do too much generics (which could avoid vtables but it's a way more typing and it's not possible to use it for everything)

cztomsik avatar Apr 02 '19 20:04 cztomsik

LLVM's PGO is what is relied on here, and it should be unable to reduce the dynamic dispatch overhead.

My understanding is that PGO is able to reorder / change the structure of branches to cooperate better with the branch predictor and (maybe) change some memory layout details, both based on recorded access / branch patterns. I don't think it can do much else.

wbrickner avatar Sep 23 '21 23:09 wbrickner