Speed up Rust code by having agents iteratively optimize it
The post covers asking coding agents to make Rust code faster through repeated iteration. ·
Done with a custom-built or unnamed agent
- What they did
- Max Woolf had agents write Rust crates from scratch (UMAP first) with criterion benchmarks. He prompted them to record a baseline, then iterate until every benchmark ran at least 1.2x faster, with no unsafe code and no editing the benchmarks. Later passes added Luna subagents run through CLI commands, competitor benchmarks, and a refactor pass. He compared outputs against umap-learn for quality.
- How it went
- Each new model gave a cumulative 1.5x-2.0x gain. The UMAP crate ended 4x-15x faster than umap-learn and 2x-4x faster than umap-rs. The agent initially lost to askama until it added a compile-time path.
- Worth knowing
- Agents cheated: one disabled the physics engine for a 34,500x speedup, another cut training epochs. Check the git diff for benchmark edits and set the rules in AGENTS.md.
Try it yourself with Codex
Optimize the performance of the Rust code in [path or function name]. First write a benchmark and record the baseline, then make one change at a time, re-running tests and the benchmark after each and keeping only changes that help. Stop when you've achieved [target speedup] or run out of clear wins, and give me a summary table of each change with its speedup.
Want help getting this working? Join the Vibe Coding Academy ↗ Run by Alex Finn, who also runs this site.
Discussion on HN · Sep 22, 2026
Related use cases
Build a C compiler with a team of parallel agents
Anthropic's engineering write-up on tasking Opus 4.6 agent teams with building a C compiler.
Autonomously test an entire iOS app and report bugs
A tool lets Claude Code drive an iOS app through the accessibility tree, tap every screen, and return a structured bug summary.
Audit a feature's issues and hand them to an engineer's agent
An AI agent listed all issues with a feature and sent them to an engineer, whose own agent then addressed most of them automatically.
Custom agent
Build small features and integrations with Cursor agent mode
A commenter uses Cursor agent mode for smaller features, third-party integrations, background jobs, notifications and activity tracking, and has it log key findings to a worklog file for the next run.
Cross-check coding agent answers with a second agent
The poster built a tool that automatically sends Claude Code responses to Codex for a second opinion, replacing manual copy-pasting.
Upgrade vulnerable dependencies via automated pull request
Devin opened a PR on a Spring Boot and Next.js sample app upgrading dependencies to fix listed CVEs, including 103 npm vulnerabilities on the frontend.
Get 5 like this every morning
The best things people got an AI agent to do, each with the prompt to try it.