Description
Hi!
I did a lot of Profile-Guided Optimization (PGO) benchmarks recently on different kinds of software - all currently available results are located at https://github.com/zamazan4ik/awesome-pgo . According to the tests, PGO usually helps with achieving better performance. That's why testing PGO would be a good idea for Typos. I did some benchmarks on my local machine and want to share my results.
Test environment
- Fedora 38
- Linux kernel 6.4.13
- AMD Ryzen 9 5800x
- 48 Gib RAM
- SSD Samsung 980 Pro 2 Tib
- Rust: 1.72
- Latest Typos from the
master
branch (commitda2759161fbf9ac2840d6955f120bc3c6f24405f
)
Test workload
As a test scenario, I used LLVM sources from https://github.com/llvm/llvm-project on commit 11db162db07d6083b79f4724e649a8c2c69913e1
. All runs are performed on the same hardware, operating system, and the same background workload. The command to run typos
is taskset -c 0 ./typos -q --threads 1 llvm_project
. One thread was used for the purpose of reducing multi-threading scheduler influence on the results. All PGO optimizations are done with cargo-pgo.
Results
Here are the results. Also, I posted Instrumentation results so you can estimate how typos
slow in the Instrumentation mode. The results are in time
utility format.
- Release:
48,86s user 3,44s system 99% cpu 52,628 total
- PGO optimized:
30,09s user 3,23s system 99% cpu 33,616 total
- PGO instrumented:
128,16s user 3,55s system 99% cpu 2:12,23 total
- PGO optimized + BOLT instrumented:
92,05s user 3,60s system 99% cpu 1:36,08 total
- PGO optimized + BOLT optimized:
29,09s user 3,16s system 98% cpu 32,585 total
Some conclusions
- PGO shows great improvements in
typos
performance - BOLT (at least in the Lite mode) optimization mode does not show great improvement here
Further steps
I can suggest to do the following things:
- Add a note to the Typos documentation about building with PGO. In this case, users and maintainers who build their own Typos binaries will be aware of PGO as an additional way to optimize the project
- Optimize provided by Typos project binaries on the CI (like it's already done for other projects like Rustc), if any