Profile-Guided Optimization (PGO) benchmark report #7
Replies: 3 comments
-
@zamazan4ik Thank you very much for your report! That's a very interesting result. I didn't realize that Lady Deirdre could perform notably better than reported in my current benchmarks. Nom and Logos performance seem to improve as well. But what surprised me is that Tree-Sitter's result stays almost the same. I don't have much experience with PGO, but based on your expertise, do you think it's because PGO optimizations are already applied to the linked C library (TS is a wrapper of a C lib), or is it due to something else? Ideally, I think that for a fair estimation, the benchmark tests should include more grammars (e.g., Java, C#). However, it is time-consuming, and I'm not sure if I have the time to implement it in the near future. It is certainly on my schedule, and I will consider PGO optimizations as well. |
Beta Was this translation helpful? Give feedback.
-
You are welcome!
No, the reason here is that
Agree. In this case, I can suggest just writing a note somewhere in the documentation that applying PGO on |
Beta Was this translation helpful? Give feedback.
-
Sounds good. I will add a note in the dedicated section of the Benchmarks README page linking to our conversations. This information should be useful for the users. P.S. I'll also move this conversation to the Discussions that I just enabled. Thank you for your help again! |
Beta Was this translation helpful? Give feedback.
-
Hi!
I was interested in optimizing the library's performance even further. I evaluated Profile-Guided Optimization (PGO) on many projects - all the results are available at https://github.com/zamazan4ik/awesome-pgo . Since this compiler optimization works well in many places, especially different parsers, I decided to apply it to the project - here are my benchmark results.
Test environment
lady-deirdre
version: the latest for now from themaster
branch on commit8fed627c54fef9e832a3ff93987d5367d51183ae
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
taskset -c 0 cargo bench --workspace --all-features
command. The PGO training phase is done withtaskset -c 0 cargo pgo bench -- --workspace --all-features
, PGO optimization phase - withtaskset -c 0 cargo pgo optimize bench -- --workspace --all-features
.taskset -c 0
is used for reducing the OS scheduler influence on the results. 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:
According to the results, PGO measurably improves the library's performance in many cases.
Further steps
I can suggest the following action points:
I would be happy to answer your questions about PGO.
P.S. Please do not treat the issue like a bug or something like that - it's just a benchmark report. Since the "Discussions" functionality is disabled in this repo, I created the Issue instead.
Beta Was this translation helpful? Give feedback.
All reactions