tectonic icon indicating copy to clipboard operation
tectonic copied to clipboard

Evaluate Profile-Guided Optimization (PGO)

Open zamazan4ik opened this issue 1 year ago • 1 comments

Hi!

Recently I checked Profile-Guided Optimization (PGO) improvements on multiple projects. The results are here.

Since PGO showed measurable improvements in compiler/interpreter-like workloads (CPython, Clang, Clangd, clang-format, GCC, Rustc, PHP, Ruby, and many others.) I think it could also be helpful to check PGO for the Tectonic project.

We need to perform PGO benchmarks on Tectonic. And if it shows improvements - add a note about possible improvements in Tectonic performance with PGO. Providing an easier way (e.g. a build option) to build the project with PGO can also be helpful for the maintainers and end-users. Improving performance can improve user experience with Tectonic.

For the Rust part of the project, you can try to use cargo-pgo, for the C part I think manual setting required compiler flags is needed (which exactly compiler flags - according to your compiler). For Rust you can get some inspiration e.g. from Typst process regarding PGO - https://github.com/typst/typst/issues/1733 .

zamazan4ik avatar Jul 29 '23 19:07 zamazan4ik

Thanks for the suggestion! Getting it to compile might indeed be a challenge, but we already have the proof-of-concept that we can build Tectonic for fuzzing, so it should be possible.

I agree that the first step would be to do some benchmarks and see what kind of improvement we might be talking about here. If it's worth pursuing, while it might be a bit of a slog to integrate PGO into the CI/CD system, that would be the way to make sure the benefits actually get realized.

pkgw avatar Aug 26 '23 22:08 pkgw