Use hypothesis testing to improve program speed
An agent explored speedup ideas, kept only the ones that stayed correct, and saved the verified changes in Git.
- What they did
- A developer set up Claude Code with a specific benchmark, a success metric, a correctness rule set, and a time budget. Once started, the agent inspected the program’s performance, framed each attempt as a falsifiable guess, made a small code commit, and checked both speed and correctness after every change. If the change failed either test, it was undone; if it passed, it remained in the branch history.
- How it went
- For KaHIP kaffpa, the process produced 122 runs from 69 hypotheses and preserved 41 patches, ending at 3.9x faster overall. VieCut reached 8.9x, with all cuts unchanged from the original. Verified patches were compared directly against the baseline output before being kept.
- Tips
- Decide exactly what counts as correct before the agent begins, because it only tests the rules you provide. If you want a low-risk trial, start with the 10-minute quick-start example first.
Try it yourself with Claude Code
In [project or codebase], have Claude Code profile [benchmark command] and look for the biggest slowdowns. Then work in a loop: propose one falsifiable speedup idea, apply the smallest code change needed, run [verification command] to check [correctness requirement], rerun [benchmark command], and retain the change only if the result is both valid and faster. If it fails, roll it back and try a different idea. After [number] attempts or once progress stalls, write a short PDF summary covering the starting measurement, each idea, the measured result, and the final speed improvement. Before any action that would remove, submit, or send work outside the repo, stop and ask me for approval.
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
Turn tracked tickets into pull requests
Use an agent to pick up issues or tickets, make the code change in an isolated pod, and open a PR for review.
Build an anonymous board for AI hopes and worries
They used Claude Code to create a site where people can post anonymously, with one model sorting entries and another finding themes.
Share files between sandboxed Claude Code agents through MCP
A developer connected sandboxed Claude Code instances to a virtual file system so they could pass files through MCP without direct access to AWS.
Let an agent turn browser edits into code
A designer changed a local site in the browser while a coding agent wrote the matching CSS updates into the codebase.
Automate a self-hosted stack on your own hardware
Jordan Fulghum let Claude Code configure and run several home services on a Beelink mini PC.
Coordinate multiple coding agents from one terminal
Corgi gives you a single terminal view for launching several coding agents and checking what each one is doing.