lcompilers / lpython

Python compiler
https://lpython.org/
Other
1.37k stars 157 forks source link

Evaluate Profile-Guided Optimization (PGO) #2217

Open zamazan4ik opened 11 months ago

zamazan4ik commented 11 months ago

Hi!

Recently I checked Profile-Guided Optimization (PGO) improvements on multiple projects. The results are here.

Since PGO showed measurable improvements in compiler/interpreter-like workloads (CPython, Clang, Clangd, clang-format, GCC, Rustc, PHP, Ruby, and many others.) I think it could also be helpful to check PGO for the LPython and LFortran projects.

We need to perform PGO benchmarks on LPython and LFortran. And if it shows improvements - add a note about possible improvements in LPython and LFortran performance with PGO. Providing an easier way (e.g. a build option) to build the project with PGO can also be helpful for the end-users.

certik commented 11 months ago

Awesome, thanks for the suggestion @zamazan4ik. If you know how to set it up, go ahead and send a PR.

zamazan4ik commented 11 months ago

If you know how to set it up, go ahead and send a PR.

That's actually a good question. I guess the most relevant example of PGO for LPython will be an example from CPython or an example from Pyston. Usually, you need a generic-enough sample workload and tweak some build scripts.

go ahead and send a PR

Maybe one day... :) Right now I have no enough time for this, sorry :(

certik commented 11 months ago

@zamazan4ik no problem. Thanks for the pointers!

zamazan4ik commented 11 months ago

@certik Just in case. The same optimization could be applied to https://github.com/lfortran/lfortran as well. Do I need to create a separate issue for LFortran as well? I think improving LFortran performance would be interesting as well :)

certik commented 11 months ago

You can just keep it here. If we do it, we'll do it for both.