Lesson: make AI show the comparison, not just the answer
Simon Willison's 8 Nov experiment asked Claude to build the same small SQLite number parser in C and Rust, compare speed and binary size, then investigate the surprising result. The useful idea is the experiment design, not a general claim that one language is faster.
What the primary sources show
- Four implementations followed the same parsing rules. The initial C version was smaller but slower on decimal inputs. After investigation, a specialized C path became the fastest in this particular test.
- On mixed data, the published net timings were 67.3 ns/row for plain C, 19.2 for optimized C, 45.9 for rusqlite and 40.5 for sqlite-loadable. These are author-reported results, not independently reproduced here.
- The comparison also recorded binary size, source complexity, dependencies and build time. A smaller binary or faster loop is not automatically the better maintenance choice.
The method worth keeping
- Define behavior before asking for alternatives. Here, 45% means 45, not 0.45; scientific notation and a leading plus sign are rejected. Those choices matter more than a fast but different answer.
- Run the same correctness cases against every version. The report includes 40 curated cases and reports 8 million fuzz comparisons with no mismatches. Passing these tests is evidence, not proof of all possible correctness.
- Measure the same workload and an appropriate baseline. The report uses two million rows, alternates implementations and subtracts a baseline scan. It reports the fastest of 15 runs, not a typical latency or a confidence interval.
- Investigate the surprising result before optimizing. The slow path was a general decimal parser, not simply the choice of C versus Rust.
- Preserve the code, test inputs, raw results and remaining caveats so the next person can question the conclusion.
Limits and cautions
- The README explicitly labels the text and code as AI-generated. The sources are the author's experiment, not an independent evaluation or an official SQLite release.
- Measurements are from a two-vCPU Linux x86-64 VM. Different hardware, compilers, data or workloads can change the outcome. These numbers do not predict whole-application speed.
- Both C variants have a locale-sensitive strtod fallback. The optimized path has floating-point constraints. The Rust loadable crate used is alpha. Do not install a database extension or copy this code into a live product based on the headline.
Application: compare expected answers before changing a product
Before changing a product, agree a small set of inputs and expected answers; preserve the old version as a baseline; compare both on exactly those cases; examine errors before speed. This helps decide whether a change is actually better rather than merely different. In a hypothetical reading recommendation feature, useful cases might include a book already read, the wrong author, or an ignored mood constraint. This is a generic application of the method, not a claim about any product or a performed test.
Primary sources and material
- Simon Willison's account, 8 Nov 2026: https://simonwillison.net/2026/Nov/8/sqlite-parse-number-c-vs-rust/