parse_number() as a SQLite extension: C vs Rust

Simon Willison tested an AI assistant to build a SQLite extension that parses formatted strings into numbers. He asked the tool to…

By Vane November 8, 2026 1 min read

Simon Willison tested an AI assistant to build a SQLite extension that parses formatted strings into numbers. He asked the tool to compare writing the function in C against Rust, noting the Rust versions were larger but faster initially. The AI generated a Rust implementation using 321 KB of code that outperformed a standard C approach. Willison then prompted the assistant to rewrite the C code specifically to beat the Rust speed. The new C version achieved 19 nanoseconds per row on mixed data, compared to 46 nanoseconds for the Rust build and 67 nanoseconds for the original C draft.

This experiment demonstrates how AI can rapidly iterate on low-level code to match or exceed performance benchmarks. It also highlights the trade-off between file size and execution speed when choosing a language for database extensions. The final output was packaged as a research report within the author’s existing collection of technical studies.

* Mixed data parsing took 19 ns with the new C code versus 46 ns for Rust.
* Integer-only parsing reached 16 ns in C against 32 ns in Rust.
* Decimal-only parsing hit 18 ns in C compared to 47 ns in Rust.

Scroll to Top