Skip to content
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 Link-Time Optimization (LTO) and Profile-Guided Optimization (PGO) for the project #137

Open
zamazan4ik opened this issue Sep 7, 2024 · 1 comment

Comments

@zamazan4ik
Copy link

Hi!

I want to discuss several compiler optimizations that could be helpful for the project. Maybe you even already tested them and have some benchmark numbers to share publicly ;)

Did you test Link-Time Optimization (LTO) for Sqlean modules? If yes, do you have any numbers regarding performance and the resulting binary size? It would be nice to test since enabling LTO is not too time-consuming thing (usually, huh).

If we are talking about more advanced things, recently I started evaluating using Profile-Guided Optimization (PGO) for various applications and workloads (including databases like PostgreSQL, ClickHouse, SQLite, MySQL and many others) - all the results are available at https://github.com/zamazan4ik/awesome-pgo . For PGO and SQLite you check this forum thread. It would be interesting to test PGO not only for SQLite itself but for such modules too to gain some additional performance wins.

Post-Link Optimization (PLO) is similar to PGO technique but uses a slightly different approach. You can take a look at LLVM BOLT for more information. However, I recommend starting playing with PLO only after applying PGO - PGO is a much more stable and time-proven technology compared to PLO tools.

By the way, I see that for several files -O1 is used instead of -O2/-O3. Could you please elaborate a bit - why such a decision was made? I guess it's connected somehow to the constant-time calculations or other "fragile" (I mean "vulnerable to dangerous compiler optimizations") but it's just a guess. Maybe LTO wasn't enabled for the same reason...

Thank you.

P.S. Since Discussions are disabled for the repository, I created an issue instead. Please don't treat it like a bug or smth like that.

@nalgeon
Copy link
Owner

nalgeon commented Sep 7, 2024

Hi Alexander! Thank you for your interest in Sqlean.

I haven't tried LTO, PGO or PLO.

O2/O3 causes test failures for some extensions, so I use O1 for them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants