mgdm / htmlq

Like jq, but for HTML.
MIT License
7k stars 107 forks source link

Evaluate Profile-Guided Optimization (PGO) and LLVM BOLT #70

Open zamazan4ik opened 9 months ago

zamazan4ik commented 9 months ago

Hi!

Recently I did many Profile-Guided Optimization (PGO) benchmarks on multiple projects - the results are available here. So that's why I think it's worth trying to apply PGO to htmlq. I already performed some benchmarks and want to share my results here.

Test environment

Benchmark setup

For benchmarking purposes, I use examples from the README file. Release build is done with cargo build --release, PGO optimized build is done with cargo-pgo. PGO profiles are collected from the benchmark workload itself.

All benchmarks are done multiple times, on the same hardware/software setup, with the same background "noise" (as much I can guarantee ofc).

Results

I got the following results: https://gist.github.com/zamazan4ik/4b5a78925532fe25a57534ddf8293696

According to the tests, PGO consistently improves htmlq performance at least in the README examples workload.

Further steps

I can suggest the following things to do:

Here are some examples of how PGO is already integrated into other projects' build scripts:

After PGO, I can suggest evaluating LLVM BOLT as an additional optimization step after PGO.