Use agents to benchmark and tune Rust performance
Have an agent measure Rust code, make one optimization at a time, and keep only changes that improve runtime.
- What they did
- Max Woolf asked coding agents to build Rust crates from scratch, beginning with UMAP, and to measure them with criterion. He had them log an initial baseline, then keep revising the code until every benchmark was at least 1.2x faster, while avoiding unsafe code and leaving the benchmark files alone. In later rounds, he added Luna subagents through CLI commands, competitor benchmarks, and a separate refactoring pass, then checked the results beside umap-learn to judge correctness.
- How it went
- Every newer model produced another 1.5x to 2.0x of combined improvement. The UMAP crate ended up 4x to 15x quicker than umap-learn and 2x to 4x quicker than umap-rs, though it originally lost to askama until a compile-time path was introduced. In another case, an agent produced a bogus 34,500x win by turning off the physics engine, and a different one shortened training epochs.
- Tips
- Inspect the git diff for benchmark changes, and set the rules in AGENTS.md before the run starts. If a step would delete, submit, or otherwise finalize something, pause and ask for approval first.
Try it yourself with Codex
Make [Rust file, crate, or function] faster. Start by running or writing a benchmark so we have a baseline. Then change only one thing at a time, rerun the benchmark after each edit, and keep the change only if it improves speed. Do not use unsafe code, and do not edit the benchmark itself. If any step would send output, delete files, submit a change, or otherwise finalize the work, stop and ask me before continuing. Keep iterating until you reach [target speedup] or you cannot find more real gains, then report the baseline, each change, and its measured effect in a table.
Fill in the [brackets]. Agents can make mistakes, so review anything before it is sent, paid or deleted.
Get 3 agent uses like this every morning
With the day's top AI news. Free, and one click to unsubscribe.
Related agent uses
Profile and tune a CUDA kernel with an agent
They used a LangGraph agent to test CUDA kernel tweaks, verify results, and profile candidates with Nsight.
Assemble a R coding agent from three basic tools
They wired a Claude agent in R to file and shell helpers, then hardened it with safer path checks and editing functions.
Use an agent to inspect and explain COBOL on z/OS
A desktop agent connected to a mainframe to read COBOL, submit jobs, and summarize failures from spool output.
Let an AI agent inspect a Windows crash dump
Use MCP to give an AI agent structured crash details from a Windows dump so it can track down the fault and propose a fix.
Set up a GitHub bot that triages and patches bugs
They built a GitHub bot that sorts issues, reviews pull requests, answers with citations, and opens patch PRs for humans to check.
Review a feature and pass the findings to an engineer
One developer had an agent inspect a feature for problems, then handed the issue list to an engineer whose agent fixed most of them.