PERFORMANCE Signal 601 2 feeds carried it
pgrust JIT compiler compiles SQL queries in around 5μs using copy-and-patch
The pgrust database project built a JIT compiler that achieves around 5μs compile times by directly targeting assembly with a copy-and-patch approach, enabling JIT compilation of every SQL query rather than only a subset.
Traditional database JIT compilers rely on LLVM or C/C++ code generation, both of which have high compile times that limit when compilation is worthwhile. At 5μs, the compilation cost is low enough to apply JIT optimization to every query, including single-execution ones. The author also notes that AI assistance made directly targeting assembly far more approachable than historically expected.
Written by elseif from the cluster below · every claim links back to a sourceThe three things worth knowing
The pgrust JIT compiler achieves around 5μs compile times by directly targeting assembly using a copy-and-patch variant rather than LLVM or C/C++ code generation.
This compile speed enables JIT compilation of every SQL query, not just frequently-executed subsets that can amortize higher compilation costs.
AI assistance significantly reduced the difficulty of writing a JIT compiler that targets assembly directly, a task the author initially expected to be much harder.
THE CLUSTER
↗