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

Opus 4.7 Broke 40% of Prompts; Fix Was Structuring CLAUDE.md and Skills
After Opus 4.7 degraded ~40% of prompts across 6 setups, a fractional head of AI fixed it by replacing ad-hoc prompts with structured Skill files, hierarchical CLAUDE.md, and separate memory files — reducing token usage 22% and iteration turns from 3-4 to 1-2.

Troubleshooting OpenClaw: A Minimalist Reset Method
A Reddit user shares a five-step method to fix unstable OpenClaw setups by removing all skills, switching to Claude Sonnet, clearing sessions, simplifying SOUL.md, and testing with basic commands.

Fixing Claude Code's KV Cache Invalidation with Local Backends
Claude Code versions 2.1.36+ inject dynamic telemetry headers and git status updates into every request, breaking prefix matching and forcing full 20K+ token system prompt reprocessing on local backends like llama.cpp. A configuration fix in ~/.claude/settings.json can reduce processing from 60+ seconds to ~4 seconds.

Cut Token Costs by 95% with OpenClaw's Seven Optimization Techniques
A comprehensive guide detailing seven techniques to reduce AI agent token consumption by 95%+, including tree-structured boot files, AI auto-compression, local model offloading, and cron-based CPU tasks.