Pgrust’s JIT compiler reportedly compiles code in about 5 microseconds, allowing the PostgreSQL-compatible database project to JIT-compile every SQL query rather than only selected queries. The implementation directly generates ARM64 machine code instead of relying on LLVM or generated C/C++, options the developer says impose higher compilation overhead. A demonstration regular-expression engine supports literal strings, concatenation, and repetition, then uses copy-and-patch compilation to turn its parsed expression tree into executable code at runtime. Reusable ARM64 instruction templates, or stencils, perform character comparisons, branching, backtracking-stack operations, success checks, and failure handling. The runtime allocates executable memory with mmap, copies generated instructions into it, invalidates the instruction cache, and calls the memory as a Rust-compatible function on macOS ARM64. For the regex b(an)*, benchmark results put the JIT implementation near handwritten code and substantially ahead of an interpreter. Across inputs from 9 to 2,049 bytes, the JIT took 3.8 to 470 nanoseconds and delivered 11.7x to 19.7x speedups over the interpreter; handwritten code took 3.8 to 393 nanoseconds. The developer says AI assistance reduced the difficulty of producing and modifying assembly-level code, which historically limited adoption of custom JIT compilers.
malisper.me
12 min
9h ago
Pgrust’s JIT compiler reportedly compiles code in about 5 microseconds, allowing the PostgreSQL-compatible database project to JIT-compile every SQL query rather than only selected queries. The implementation directly generates ARM64 machine code instead of relying on LLVM or generated C/C++, options the developer says impose higher compilation overhead. A demonstration regular-expression engine supports literal strings, concatenation, and repetition, then uses copy-and-patch compilation to turn its parsed expression tree into executable code at runtime. Reusable ARM64 instruction templates, or stencils, perform character comparisons, branching, backtracking-stack operations, success checks, and failure handling. The runtime allocates executable memory with mmap, copies generated instructions into it, invalidates the instruction cache, and calls the memory as a Rust-compatible function on macOS ARM64. For the regex b(an)*, benchmark results put the JIT implementation near handwritten code and substantially ahead of an interpreter. Across inputs from 9 to 2,049 bytes, the JIT took 3.8 to 470 nanoseconds and delivered 11.7x to 19.7x speedups over the interpreter; handwritten code took 3.8 to 393 nanoseconds. The developer says AI assistance reduced the difficulty of producing and modifying assembly-level code, which historically limited adoption of custom JIT compilers.
malisper.me
12 min
9h ago
Pgrust’s JIT compiler reportedly compiles code in about 5 microseconds, allowing the PostgreSQL-compatible database project to JIT-compile every SQL query rather than only selected queries. The implementation directly generates ARM64 machine code instead of relying on LLVM or generated C/C++, options the developer says impose higher compilation overhead. A demonstration regular-expression engine supports literal strings, concatenation, and repetition, then uses copy-and-patch compilation to turn its parsed expression tree into executable code at runtime. Reusable ARM64 instruction templates, or stencils, perform character comparisons, branching, backtracking-stack operations, success checks, and failure handling. The runtime allocates executable memory with mmap, copies generated instructions into it, invalidates the instruction cache, and calls the memory as a Rust-compatible function on macOS ARM64. For the regex b(an)*, benchmark results put the JIT implementation near handwritten code and substantially ahead of an interpreter. Across inputs from 9 to 2,049 bytes, the JIT took 3.8 to 470 nanoseconds and delivered 11.7x to 19.7x speedups over the interpreter; handwritten code took 3.8 to 393 nanoseconds. The developer says AI assistance reduced the difficulty of producing and modifying assembly-level code, which historically limited adoption of custom JIT compilers.
malisper.me
12 min
9h ago
No more articles to load