415.tech
AI & tech, from the frontlines of Silicon Valley
pgrust JIT-compiles every SQL query in about 5 microseconds

pgrust JIT-compiles every SQL query in about 5 microseconds

The pgrust JIT emits machine code in roughly 5 microseconds using copy-and-patch stencils, fast enough to compile every SQL query rather than the subset LLVM- or C-codegen databases can afford at millisecond compile times. The ARM64 regex walkthrough in Rust is a working template for JIT-compiling a hot interpreter without LLVM: on the pattern b(an)*, it matches a 9-character input in 3.8ns against 3.8ns handwritten and a 2,049-character input in 470ns against 393ns. All timings are the author's own macOS measurements, not an independent benchmark.

Source: malisper.me

Post on XEmail

The pgrust JIT compiler compiles code in around 5μs, which enables us to JIT compile every SQL query, not just a subset of them.

pgrust author

Why this matters

  • → Compiles every SQL query at ~5 microseconds—fast enough to replace compile-time tradeoffs
  • → Copy-and-patch JIT sidesteps LLVM bottleneck, enabling rapid iteration on hot code paths
  • → Opens feasible path for new databases to match or exceed traditional engines on performance
Database JIT goes fast
Also in this edition