News for hackers. Stuff that matters.
Re:Look ma, I wrote a new JIT compiler for PostgreSQL by pinaraf on Monday March 18, 2024 @09:38AM (#39744324)
Honestly I thought the same as you, then I wrote this, and I now understand it's going to be really hard to do. To make it very simple: there are pointers to query parts "leaking" everywhere across the execution engine. Removing them will require a significant overall of the execution engine, the planner and who knows what else. Even in a single session, two compiled queries will have different compiled code because of that (both llvm and my copyjit have to inject the adresses of various structs in asm code)
Re:Look ma, I wrote a new JIT compiler for PostgreSQL by adzm on Monday March 18, 2024 @09:53AM (#39744534)
Just going to say, I'm blown away by how simple this JIT is though. Really quite a beautiful JIT approach.
Re:Look ma, I wrote a new JIT compiler for PostgreSQL by pinaraf on Monday March 18, 2024 @10:02AM (#39744690)
Same for me, that's why I did this after finding out this research paper. With the proper compiler settings and small tricks you can remove some parts and already end up faster than the interpreter (because you remove some branches and a few memory accesses) and it's even possible to create "super-stencils" covering typical opcodes series and optimizing them further. Or the opposite, "sub-stencils" in order to do some loop unrolling for instance.