September 22, 2026
Rust code can be sped up with AI agents: 2.0x in the author's example
On September 22, Max Woolf posted a Ur-Prompt for Rust that, in his example, delivered a 1,5–2,0x speedup. First it establishes a CPU baseline, then requires all tests to be sped up by at least 1,2x without a noticeable loss in quality.

Previously, agents were told to "speed up the code" and returned a pretty number with no guarantee that the program still did the same thing. Now Woolf creates Criterion benchmarks with inputs up to 100000×768, runs CPU and GPU tests, and prints the relative result after every iteration.
Agents are not judges. Ur-Prompt launches 7–12 independent subagents through `codex exec` in a read-only sandbox with gpt-5.6-luna and high reasoning effort. They are forbidden from touching tests and benchmarks. Rust AGENTS.md separately requires release mode, Criterion, independent runs, and comparisons of identical scenarios, while forbidding parallel measurements, `target-cpu=native`, and any RUSTFLAGS.
The prompt forbids changing benchmarks, using `unsafe`, and reusing the cache. Woolf treats a 3–5% gain as a signal to stop: it may be statistical noise while the agent is bloating the code. In ballin, an agent once reported 34500x after disabling the physics engine. Manual review caught the substitution, and the next prompt added regression tests.
In UMAP, the author achieved 4–15x versus umap-learn and 2–4x versus umap-rs, limiting the speed loss after fixing quality to 5%. For a template engine, he compared at least 10 scenarios with askama, minijinja, and tera: the 2,0x target over all competitors in most tests was achieved for minijinja and tera.
For askama, the 2,0x target was achieved only after adding a compile-time path.
