armedbear / abcl

Armed Bear Common Lisp <git+https://github.com/armedbear/abcl/> <--> <svn+https://abcl.org/svn> Bridge
https://abcl.org#rdfs:seeAlso<https://gitlab.common-lisp.net/abcl/abcl>
Other
288 stars 29 forks source link

Evaluate implementing Profile-Guided Optimization (PGO) approach in ABCL #646

Open zamazan4ik opened 9 months ago

zamazan4ik commented 9 months ago

Hi!

Profile-Guided Optimization (PGO) is a compiler optimization technique that uses information collected from runtime to optimize a program in compile-time (if we are talking about the Ahead-Of-Time (AoT) compilation model).

I do an investigation about Profile-Guided Optimization (PGO) adoption across the industry: check PGO integration in different projects, perform PGO benchmarks, etc. - all my current results are available in my repo: https://github.com/zamazan4ik/awesome-pgo

According to my tests, PGO helps a lot with optimizing different applications in different domains in real-life workloads: compilers, static analysis, databases, networking, logging, and much more. PGO is already integrated into many compilers like Clang, GCC, Rustc, Go, GraalVM (could be the most interesting to ABCL since it implements PGO for Java).

In this issue, I suggest implementing PGO support in the compiler. As a reference, I can suggest looking at the most mature (in my opinion) PGO implementations right now: GraalVM (https://www.graalvm.org/22.0/reference-manual/native-image/PGO/), LLVM (e.g. check Clang PGO documentation - https://clang.llvm.org/docs/UsersManual.html#profile-guided-optimization) and GCC (https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html#index-fprofile-generate).

Would be great to hear what do you think about the idea. However, I understand that implementing such a feature is not an easy thing to achieve and requires large implementation efforts. Please consider this issue just as an idea for the project.