JIT Compiling Code in 5μs: Building a Fast JIT for Postgres pgrust
Historically, fast JIT compilation was a black art. Production databases either use LLVM or generate C/C++ code, both with high compile times. Now, AI assistance makes it practical to write a JIT compiler that directly targets assembly, achieving compile times around 5μs. This is what the author did for pgrust, a Postgres extension in Rust.
The key insight: JIT compilation is valuable when runtime information drastically alters behavior, like parsing data with unknown schema. For databases, JIT-compiling every query can yield 2-5x performance wins, but only if compile time is negligible. LLVM and C/C++ generation take milliseconds, limiting their use to complex queries only. A 5μs JIT can handle every query.
To demonstrate, the article builds a toy regular expression engine supporting literals and repetition (*). The regex b(an)* is used as a benchmark. The interpreter version is 10-20x slower than handwritten code. The JIT approach aims to close that gap.
Key points from the post:
- JIT compilation is the practice of generating compiled code at runtime, often giving 2-5x performance gains.
- Traditional JIT routes (LLVM, C generation) suffer from high compile times.
- AI assistance lowers the barrier to writing assembly-generating JITs.
- pgrust's JIT compiler compiles code in around 5μs, enabling JIT for every SQL query.
- The article provides a walkthrough of building a simple regex engine with JIT, skipping the parser for simplicity.
For developers interested in database internals or JIT techniques, this post offers practical insights into a new approach that could improve on legacy systems.
📖 Read the full source: HN AI Agents
👀 See Also

vLLM Setup and Testing on 10x NVIDIA V100 Server with 320GB VRAM
A lawyer building a local AI server for legal work shares vLLM testing results on 10x Tesla V100 SXM2 32GB GPUs, detailing what works (FP16 unquantized, bitsandbytes 4-bit) and what doesn't (GPTQ, AWQ, FlashAttention2) on Volta architecture.

Optimizing GLM-4.7-Flash on M4 Mac Mini with 24GB RAM
A developer shares specific configuration details for running GLM-4.7-Flash on an M4 Mac Mini with 24GB RAM, including Q3_K_XL quantization, 32k context size with MLA, and memory allocation realities for Metal.

Qwen3.x models fail silently in OpenClaw due to streaming output format mismatch
Qwen3.x models in streaming mode output to the 'reasoning' field instead of 'content', causing OpenClaw to silently fall through to fallback models. A proxy that translates API formats and injects 'think: false' fixes the issue, enabling full tool-call evaluation.

Automating OAuth Token Refresh for Bots Using Claude Code
A Reddit user shares a method to prevent OAuth token expiration by configuring Claude Code to automatically refresh tokens every 8 hours, keeping bots running continuously without manual intervention.