Don't rewrite it in Rust. Port the 5% that's slow.

The phrase "rewrite it in Rust" has been a joke for so long that it stopped being advice and became a genre. The joke works because the advice is almost always wrong: a full rewrite throws away working behaviour to buy speed you mostly do not need in the places you did not measure.
EL4CTEO/fast-anything takes the sane subset of that idea. It profiles your app, ranks functions by time and portability, has your coding agent port only the winners, and then refuses to ship them until they reproduce the original's output on real recorded calls. It has 4,844 stars, is written in Rust, and installs in one line.
npm i -g @el4cteo/fast-anything # or: cargo install fast-anything
The workflow is six commands
The design assumes an agent is doing the porting, so the human interface stays small.
fast-anything go --agent claude -- python app.py
That one command runs the loop. Underneath, the steps are visible and separately callable.
| Command | What it does |
|---|---|
scan -- <cmd> | Profiles the app, ranks functions by time and portability |
port [id] | Records real calls, creates a one-function Rust crate with a TASK.md |
verify | Builds the port, replays every recorded call against it |
enable / disable | Switches the Rust in or out |
bench | Times the whole app, original vs Rust, with an A/A noise control |
report | Markdown and an SVG card for your pull request |
scan takes flags that matter in practice. --duration 30 is for servers and GUIs, where the interesting work happens after the first second. --calibrate measures the profiler's own overhead, which is the difference between a ranking and a fantasy. --explain checks the setup without running anything. Every command accepts --json, which is how you would wire this into CI.
The porting step is where the taste is. port records real calls and hands the agent a single-function crate plus a task file. One function at a time, reversible. That is the correct unit of change for a performance patch, because it is the largest unit a reviewer can still hold in their head.
The gate is the product
Everything above is plumbing. The reason to trust this thing is the verification protocol.
Every port is replayed against up to 500 recorded calls. On top of that, edge cases are answered by the original implementation: NaN, positive and negative infinity, negative zero, empty input, non-ASCII strings, and inputs larger than anything in the recording.
Every fifth call is held out from the agent. The port cannot special-case what it was shown, because a fifth of the evidence was never shown.
Nothing is enabled until all cases match, and a port that is slower per call stays off, no matter how elegant the Rust is.
FAST_ANYTHING_DISABLE=1 restores the original at any time, which turns a performance experiment into a switch rather than a migration.
That last property is the one that makes this usable in a real codebase. Performance work normally carries a hidden cost: once the fast path is in, nobody dares remove it, because the fallback was deleted during the rewrite. A one-variable environment switch keeps the fallback alive and honest.
The numbers
The repository publishes results from real runs on an i5-10500 with Windows 11, with C and C++ measured on a GitHub Actions Linux runner. The benchmark is a fuzzy dedupe workload implemented in nine languages, plus a Mandelbrot set in C.
| App | Before | After |
|---|---|---|
| Python fuzzy dedupe | 4.91s | 42ms, 116x |
| PHP fuzzy dedupe | 2.94s | 53ms, 55x |
| Go fuzzy dedupe | 3.02s | 144ms, 21x |
| TypeScript fuzzy dedupe | 3.11s | 155ms, 20x |
| Ruby fuzzy dedupe | 3.13s | 228ms, 14x |
| C# fuzzy dedupe | 4.03s | 312ms, 13x |
| C mandelbrot | 431ms | 127ms, 3.4x |
| Java fuzzy dedupe | 3.50s | 1.18s, 3x |
| C++ fuzzy dedupe | 3.02s | 1.09s, 2.7x |

Read the table as a ranking of how much overhead each runtime adds, not as a ranking of languages. Python's 116x is mostly the interpreter leaving the room. Java's 3x comes with a footnote the README supplies itself: the function got 11x faster, and JVM startup ate most of the gain. C and C++ gain least because there was least to remove.
That self-criticism is a good sign. A benchmark that only publishes flattering rows is marketing.
Recording calls for something that never exits
The workflow is easiest to picture with a batch script: run it, record the calls, port the hot function, replay, enable. A server is harder because it never finishes, which is what --duration 30 is for. The scan runs the app for a fixed window, records what happens while you exercise it, and ranks functions from that sample. The quality of the port depends on the quality of that window, and a quiet thirty seconds produces a profile of an idle process.
There is an honest failure mode here that the tool cannot fix. If you record calls during a light period and the function behaves differently under load, verification passes and production does not. The edge cases cover the mathematical boundaries, not the traffic patterns.
For a GUI, the same problem appears as "what did the human click". A profile taken while you click through three screens is a sample of three screens. That is still useful, since it is three real screens rather than a synthetic benchmark, but it is a sample, and the width of it is your responsibility.
Reading the report card
report writes markdown plus an SVG card for the pull request. The card is the artefact a reviewer actually looks at, so it is worth understanding what belongs on it.
The useful contents are boring: which function was ported, how many recorded calls were replayed, whether the outputs matched exactly, what the per-call time was before and after, and how much of the whole-app improvement is attributable to this change rather than to noise. The A/A control is what makes the last number credible.
What should not be on the card is a single headline multiplier. "116x faster" is a claim about one function in one workload. The whole app got faster by whatever fraction of runtime that function occupied, which is usually smaller and always more honest. A reviewer who sees only the headline will approve a change they do not understand, and that is how performance work turns into folklore.
Where this breaks
The honest limits are structural.
Portability ranking is a heuristic. A function that is hot but entangled with reflection, dynamic dispatch or a runtime object model will rank low, and the tool will correctly skip it. That means some of the biggest wins are unreachable, which is fine and should be said out loud.
Recorded calls are a sample. Five hundred real calls beats zero real calls by a wide margin, but a function whose behaviour depends on input you did not record can still pass verification and fail in production. The edge cases mitigate this. They do not eliminate it.
The A/A control in bench is the part most performance tools skip. Running the original against itself tells you how much of your measured improvement is noise, and on a laptop with thermal throttling the answer is often "more than you think".
Finally, the workflow assumes your app can be started by a command and profiled. Long-running services, GUI apps and anything with a hardware dependency need the --duration path and some patience.
Why this pattern will outlive the tool
The interesting move here is the contract, which happens to be written in Rust: one function, real calls, held-out sample, automatic rollback, and a report card attached to the pull request.
That contract is what makes it safe to let an agent touch performance-sensitive code. Without it, you are asking a model to rewrite a hot loop and hoping. With it, the model's work is accepted or rejected by a test harness that the model did not write and cannot see all of.
Expect this shape to spread. Profilers already know where the time goes. Agents can already write the replacement. The missing piece was a referee, and a referee is cheaper to build than a rewrite.
Turn ideas into images with ChatPicture
60 free credits every day. Generate, edit, and download — no prompt engineering degree required.
Related articles
Thirteen eggs stump a whole lineup of models: AI images can draw, but they cannot count
On the evening of November 18, "Doubao stumped by thirteen eggs" reached Weibo's trending list. Of nine image models, only four got the number right, and research already says prompt tweaks cannot fix counting. The problem is a diffusion model with no counter.
A trading skill pack that refuses to tell you what to buy
claude-trading-skills ships four workflows for reviewing a portfolio, screening a setup and journaling a closed trade. It never issues a buy signal, and the README says so three times.
Tencent's Hy3D 3.6 generates the 3D draft, not the finished asset
Hy3D 3.6 pushes generated models to two million faces and eight-kay PBR textures, then hands them to a retopology artist. Tencent had hundreds of its own 3D artists blind-test it first.
ChatPicture
Start generating
Generate production-ready AI images for e-commerce, design, and film.