-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Evaluate using Profile-Guided Optimization (PGO) #1689
Comments
@zamazan4ik Thank you! Looks very interesting. My understanding is that PGO optimizes based on input in this case, however do we know that we didn't specifically optimize for the benchmark schema only? (as in while there may be some commonalities in input, it'd still be somewhat random in terms of what it can contain) Do these tools output any sort of indication as to what changes they're making? Since what you're benchmarking is directly used for the optimization it'd be hard to know whether it's generally faster or specifically faster for the benchmark Thank you! |
(excuse me please for the so late response)
I guess that many inputs for the tool share similar internal paths for the tool so it will be safe to prepare some "real life" training dataset for the tool and use it during the preoptimization, and it should work well for real users (deliver PGO-preoptimized linter for users).
If we are talking about PGO - it's not a dedicated tool, it's a compiler part. In general case, no - the compiler doesn't report changes that are made to your program with PGO - it's an internal thing for the compiler. You should expect different inlining decisions, hot/cold splitting and similar things. If you want to understand more, I can suggest using disassembler to compare non-PGOed vs PGOed assembly for the tool.
Fair point. You can prepare one different dataset for training and another one for evaluating, and then perform the corresponding benchmarks once again. I am 99% sure that for this tool PGO will bring the same performance benefits in such a benchmark scenario too since code paths will be similar. |
Hi!
I just read your article about optimizing the
graphql-lint
performance. Since I tested one specific compiler optimization - Profile-Guided Optimization (PGO) - on various projects with positive results (you can find all benchmarks here: https://github.com/zamazan4ik/awesome-pgo), I decided to test the optimization withgraphql-lint
.Test environment
main
branch on commit5605d62f69790f62a385e8155bddf838f977165b
Benchmark
For benchmark purposes, I use built-in into the project benchmarks. For PGO optimization I use cargo-pgo tool. Release bench result I got with
cargo bench
command. The PGO training phase is done withcargo pgo bench
, PGO optimization phase - withcargo pgo optimize bench
.All measurements are done on the same machine, with the same background "noise" (as much as I can guarantee).
Results
I got the following results:
PGO optimized compared to Release:
(just for reference) PGO instrumentation compared to Release:
According to the results, PGO measurably improves the tool's performance at least in the benchmark above. However, I think we need to perform the benchmarks on more datasets.
Further steps
I can suggest the following action points:
Testing Post-Link Optimization techniques (like LLVM BOLT) would be interesting too (Clang and Rustc already use BOLT as an addition to PGO) but I recommend starting from the usual PGO.
I would be happy to answer your questions about PGO.
The text was updated successfully, but these errors were encountered: