AI 辅助对比 C 与 Rust 的 SQLite 扩展
Simon Willison 的博客介绍了一项 AI 辅助实验,对比四个以 C 和 Rust 实现相同 parse_number() 行为的 SQLite 扩展。经过优化的 C 版本每行耗时 16–19 纳秒,速度约为 Rust 版本的两倍,四个实现还在 800 万次模糊测试中产生了相同结果。最初的 Rust 二进制文件也明显大于 C 扩展。
该实验从实现体积、解析性能和正确性等维度展示了实际 SQLite 扩展的工程取舍,并表明紧凑的 C 快速路径能够弥补乃至逆转 Rust 的性能优势。
Research: parse_number() as a SQLite extension: C vs Rust
Simon Willison’s Weblog
Sponsored by: Dynatrace — Your coding agent can read your code but can’t see how it runs in production. Read the blog to see how Dynatrace MCP closes that gap.
8th November 2026
Research parse_number() as a SQLite extension: C vs Rust — Four SQLite extensions implement the same `parse_number()` behavior in C and Rust, with tests covering type preservation, parsing rules, and floating-point accuracy. The optimized C implementation was fastest at 16–19 ns per row, about twice as fast as the Rust versions and far faster than SQL `replace()`. Plain C was slower on decimals because it relied on `strtod()`, while a compact fast path closed that gap; all versions matched across 8 million fuzz checks.