Port the 5% that's slow: hands-on with fast-anything's Rust speedup loop
fast-anything finds the few functions where your Python app actually spends its time, has your coding agent port only those to Rust, and proves the port behaves identically on recorded real calls. I ran the full loop on its fuzzy-dedupe example: 20.2 seconds became 269 milliseconds — 75× faster, with 33 out of 33 verification checks passing.
- The loop: doctor checks the toolchain, scan finds the hotspot, port records real calls and generates the Rust crate, verify proves the port identical, enable swaps it in, bench measures the whole app interleaved. One command with --agent claude runs it end to end.
- Measured here: the fuzzy-dedupe example went from a 20.21s median to 269ms (75×, five interleaved runs each); the function itself went from 19,892.6ms to 221.3ms per call (90×); verify passed 33/33 checks (1 recorded + 7 edge + 25 derived), with byte-identical output.
- Only the hotspot moves: the port is one function plus its helpers; the rest of the app stays Python. The swap is one marked block in the source file, removable byte for byte, and FAST_ANYTHING_DISABLE=1 restores the original any time.
- What can move: top-level, deterministic functions that take plain data. Scan disqualifies the rest itself — I/O, randomness, and non-plain-data arguments each get a named reason.
- The project: fast-anything (EL4CTEO/fast-anything), created November 21, 2026, 3,356 stars and 226 forks in three days, MIT licensed, installable from npm as @el4cteo/fast-anything (0.8.6) or from Cargo.

Rewriting an app in Rust costs months, minute-long compiles, and gigabytes of target/. Most of the runtime sits in a few functions anyway. That is the whole pitch of fast-anything, a small open-source tool that finds those functions, has your coding agent port only them to Rust, proves the port gives the same results on real recorded calls, and swaps it in. One command, fully reversible.
The project is three days old and already hard to ignore: created on November 21, 2026, it collected 3,356 stars and 226 forks in its first three days, topped the week’s list of new AI projects on GitHub, and ships as an npm package, a Cargo install, a Claude Code plugin, and an MCP server. The idea lands because it inverts the usual advice. Instead of “rewrite it in Rust,” it asks: which 5% is slow, and can we prove the replacement is identical?
I ran the full loop on the project’s own example, a Python fuzzy-dedupe app, on a shared 4-vCPU Linux VM: install, profile, port, verify, enable, benchmark. The app went from a median of 20.21 seconds to 269 milliseconds end to end — 75× faster — with the output byte-identical and 33 out of 33 verification checks passing. Every command and number below comes from that run.
1. What you’ll need#
- Node.js 22+ for the npm install (or a Rust toolchain for the Cargo install). I used Node v24.22.1.
- A Rust toolchain via rustup. Ports are compiled with your local toolchain — I used cargo 1.99.1 and rustc 1.99.1.
- Python 3.10+ for the demo app (I used 3.12.3). The tool also supports JavaScript/TypeScript, Ruby, Java, Kotlin, Go, PHP, C, C++, C#, and R, each through a different bridge.
- A coding agent, or a willingness to write one small Rust function by hand. The normal flow passes
--agent claude(orcodex, or any command that reads a prompt on stdin) and the agent writes the port. No signed-in agent was available in this sandbox, so I wrote the port by hand from the generated spec — and the verification step that follows does not care who wrote it. - No API key, no account, no cloud. Everything runs on your machine. The whole exercise costs $0.
2. Step 1 — Install and check the toolchain#
npm i -g @el4cteo/fast-anything # or: cargo install fast-anything
fast-anything --version
fast-anything doctor
Version 0.8.6 installed cleanly from npm. doctor checks Rust, your runtimes, and your agents, and it is the gate for everything after it:
⚡ fast-anything v0.8.6
✓ cargo cargo 1.99.1 (5f94df478 2026-08-27)
✓ python Python 3.12.3
✓ node v24.22.1
· ruby not found (for Ruby apps (3.3+)): https://ruby-lang.org
· java not found (for Java apps (22+)): https://adoptium.net
· go not found (for Go apps (1.22+)): https://go.dev/dl
· php not found (for PHP apps (8.1+, extension=ffi)): https://php.net
✓ clang gcc (Ubuntu 13.3.0-6ubuntu2~24.04.1) 13.3.0
· dotnet not found (for C# apps (.NET SDK 8+)): https://dot.net
· Rscript not found (for R apps (4.0+)): https://www.r-project.org
✓ bun 1.4.4
· deno not found (to run JS/TS apps on Deno (instead of node)): https://deno.com
· claude not found (--agent claude): https://claude.com/claude-code
✓ codex codex-cli 0.164.0-alpha.9
✓ ready to scan
✓ ready to port
The missing entries are only needed if you port apps in those languages. For a Python app on this machine, ready to scan and ready to port is the whole requirement.
3. Step 2 — Profile before you touch anything#
The demo is the repo’s own examples/fuzzy-dedupe: a script that generates 700 customer names with typos and finds near-duplicate pairs. Clone the repo, copy the example somewhere to work in — fast-anything writes a .fast/ directory into the app folder — and get a baseline first:
git clone https://github.com/EL4CTEO/fast-anything.git
cp -r fast-anything/examples/fuzzy-dedupe demo && cd demo
python3 app.py
700 names, 822 likely duplicate pairs
'Noah Msller' ~ 'Noah Müller'
'Noah Msller' ~ 'Noah Müller'
'Mateo Esposito' ~ 'Matteo Esposito'
'Mateo Esposito' ~ 'eatteo Esposito'
'Mateo Esposito' ~ 'Mateo Essosito'
That run took 18.6 seconds of wall time. Keep the output — it is the correctness target for everything that follows. Now profile:
fast-anything scan -- python3 app.py
⚡ fast-anything v0.8.6
▸ profiling python3 app.py
✓ python3 app.py ran in 75.32s
# function time calls verdict
1 fuzzy.find_duplicates █████████ 100.0% 1 ✓ port it
! calls levenshtein, normalize, they get ported together with it
2 app.py:main █████████ 100.0% 1 ✗ does I/O: print
3 fuzzy.levenshtein █████████ 99.6% 244,650 ↳ ported inside find_duplicates
4 app.py:make_names 0.0% 1 ✗ not deterministic: random.Random
5 fuzzy.normalize 0.0% 700 ↳ ported inside find_duplicates
→ fast-anything port fuzzy.find_duplicates
Two things to notice. First, the profiled run took 75.32 seconds against the 18.6-second plain run — profiling overhead is roughly 4×, so never compare a profiled time against a plain time. Second, the ranking is doing real judgement, not just sorting by time. find_duplicates owns 100.0% of the runtime and is portable, so it gets the check mark. main is disqualified for doing I/O. make_names is disqualified for using random.Random — a port has to be deterministic. levenshtein, at 244,650 calls and 99.6% of time, is not ported on its own: it gets ported inside find_duplicates, with normalize alongside it.
That last point is the design decision the whole tool turns on. fast-anything ports the outermost loop it can, not the tiny function called inside it, so the app crosses into Rust once instead of millions of times. The project’s own numbers for porting only the inner levenshtein were 35× in one case and 1.9× in another, against 116× for the outer loop on the same example.

4. Step 3 — Record real calls#
fast-anything port fuzzy.find_duplicates
⚡ fast-anything v0.8.6
▸ running the app again to record real calls to fuzzy.find_duplicates
✓ recorded 1 real call to fuzzy.find_duplicates (of 1 made)
✓ Rust crate ready: /var/tmp/acverify/demo/.fast/ports/fuzzy.find_duplicates
Have your coding agent follow TASK.md and write src/lib.rs, then:
→ fast-anything verify fuzzy.find_duplicates
port runs the app once more and records the actual arguments the function received — here, the full list of 700 names — up to 500 calls. Then it generates a one-function Rust crate with a TASK.md spec. The crate is minimal on purpose: a Cargo.toml pinning PyO3 0.30 with the abi3-py310 feature, a cdylib library target, release settings (opt-level = 3, fat LTO, one codegen unit), and a src/lib.rs stub with the exact signature:
#[pyfunction]
#[pyo3(signature = (names, max_distance = 2))]
fn find_duplicates(names: Vec<String>, max_distance: i64) -> PyResult<Vec<(i64, i64)>> {
todo!("port fuzzy.find_duplicates")
}
TASK.md is the contract the port has to satisfy. It includes the original Python, the two helpers, the recorded call, and the rules: same result for every input including edge cases; Python strings index by Unicode code point, so use .chars(); Python ints don’t overflow, so i64 is fine; floats compare within 1e-9; where Python raises, raise too; standard library only unless a crate clearly pays off.
5. Step 4 — Write the Rust port#
In the normal flow this is fast-anything go --agent claude -- python app.py and the agent writes the port. Here I wrote it by hand from TASK.md — no signed-in agent was available — which is also the honest way to show what the port actually contains. The full implementation:
use pyo3::prelude::*;
/// Edit distance over Unicode code points, exactly like the Python version.
fn levenshtein(a: &[char], b: &[char], prev: &mut Vec<i64>, curr: &mut Vec<i64>) -> i64 {
// Caller guarantees a.len() >= b.len().
prev.clear();
prev.extend(0..=(b.len() as i64));
for (i, &ca) in a.iter().enumerate() {
curr.clear();
curr.push(i as i64 + 1);
for (j, &cb) in b.iter().enumerate() {
let cost = if ca == cb { 0 } else { 1 };
let v = (prev[j + 1] + 1).min(curr[j] + 1).min(prev[j] + cost);
curr.push(v);
}
std::mem::swap(prev, curr);
}
prev[b.len()]
}
/// Python " ".join(name.lower().split()): full Unicode lowercase, split on
/// Unicode whitespace runs, rejoin with single spaces.
fn normalize(name: &str) -> String {
let lower = name.to_lowercase();
let mut out = String::with_capacity(lower.len());
for (i, word) in lower.split_whitespace().enumerate() {
if i > 0 {
out.push(' ');
}
out.push_str(word);
}
out
}
#[pyfunction]
#[pyo3(signature = (names, max_distance = 2))]
fn find_duplicates(names: Vec<String>, max_distance: i64) -> PyResult<Vec<(i64, i64)>> {
// Normalize once, and keep each name as chars once: the pairwise loop
// then does no string work at all.
let clean: Vec<Vec<char>> = names.iter().map(|n| normalize(n).chars().collect()).collect();
let mut pairs: Vec<(i64, i64)> = Vec::new();
let mut prev: Vec<i64> = Vec::new();
let mut curr: Vec<i64> = Vec::new();
for i in 0..clean.len() {
for j in (i + 1)..clean.len() {
let (a, b) = if clean[i].len() >= clean[j].len() {
(&clean[i], &clean[j])
} else {
(&clean[j], &clean[i])
};
// Edit distance is at least the length difference: exact filter.
if (a.len() as i64 - b.len() as i64).abs() > max_distance {
continue;
}
if levenshtein(a, b, &mut prev, &mut curr) <= max_distance {
pairs.push((i as i64, j as i64));
}
}
}
Ok(pairs)
}
Two exactness decisions matter. First, the Python levenshtein compares characters one code point at a time, so the Rust version works on &[char] slices — never on bytes, which would split multi-byte characters like ü and ł. Rust’s to_lowercase and split_whitespace match Python’s lower() and split() on this data, including the accented names in the example. Second, the length-difference filter skips the DP entirely when two names differ in length by more than max_distance. That is exact, not approximate: edit distance can never be smaller than the length difference, so a skipped pair could never have qualified. cargo check passed clean against PyO3 0.30.1.
6. Step 5 — Verify: prove it, don’t trust it#
fast-anything verify fuzzy.find_duplicates
⚡ fast-anything v0.8.6
▸ building fa_fuzzy_find_duplicates (release)
▸ replaying 1 recorded call against the Rust port
✓ 33/33 calls give the same result (1 recorded + 7 edge cases + 25 derived)
✓ fuzzy.find_duplicates per call: 19892.6ms in Python, 221.3ms in Rust: 90× faster
→ fast-anything enable fuzzy.find_duplicates
This is the step that justifies the tool. verify release-builds the crate and replays the recorded call against it, then adds derived cases: edge cases (empty input, non-ASCII text, very long input) and shrunk inputs, with the original Python answering each one so there is a ground truth to compare against. All 33 calls — 1 recorded, 7 edge, 25 derived — returned the same result. Nothing gets enabled until every case matches, and a port that is correct but slower per call than the original isn’t enabled either: calling into Rust costs more than the work saved for tiny functions, and the tool refuses to make you slower.
The project’s own example of why this matters: a port that looked right but compared bytes instead of characters was caught by 148 of 500 recorded calls. That is exactly the bug class my .chars() decision avoids, and it is the reason the verify step exists at all — a port written by an agent, or by hand, is only as trustworthy as the replay that checks it.
7. Step 6 — Enable it and measure the whole app#
fast-anything enable fuzzy.find_duplicates
python3 app.py
enable appends one marked block to fuzzy.py. It imports the compiled extension from .fast/lib and rebinds the name find_duplicates to the Rust version, falling back to the Python original if the import fails. The original function stays in the file, untouched above the block. Running the app now prints the identical output — 700 names, 822 pairs, the same five sample pairs. Then the measurement that counts:
fast-anything bench
⚡ fast-anything v0.8.6
▸ timing python3 app.py (5 runs each, Python vs Rust, interleaved)
Python ████████████████████████ 20.21s
Rust ▍ 269ms
✓ python3 app.py is 75× faster end to end (median of 5, ±2.37s)
| Median | Mean | Min | Max | Stddev | |
|---|---|---|---|---|---|
| Python (5 runs) | 20.21s | 19.22s | 16.18s | 22.52s | 2.37s |
| Rust port (5 runs) | 269ms | 254ms | 145ms | 362ms | 74ms |
That is 75.2× end to end, median of five interleaved runs each. Two honest caveats. The project’s README reports 116× for this same example — 4.91 seconds to 42 milliseconds — but on an i5-10500 running Windows 11, not on this shared VM, and their number is the function, not the whole app. My function-level number was 90× (19,892.6ms to 221.3ms per call); the end-to-end 75× is lower because the app still pays interpreter startup and name generation in Python. And the spread on the Python side (±2.37s) is real: a shared VM’s timings wander, which is why bench interleaves the runs instead of timing five Python runs and then five Rust runs.

8. Step 7 — Ship the result#
fast-anything report
fast-anything status
⚡ fast-anything v0.8.6
✓ report: /var/tmp/acverify/demo/.fast/report.md
✓ share card: /var/tmp/acverify/demo/.fast/report.svg
⚡ fast-anything v0.8.6
app: python3 app.py profiled run: 75.32s
fuzzy.find_duplicates ● on (Rust) 90× per call
last bench: 20.21s → 269ms (75×)
report writes a Markdown summary and an SVG share card for the pull request — the before/after numbers, the per-function speedup, and the verification count. The generated report for this run reads, in full: “python3 app.py went from 20.21s to 269ms (median of 5 runs each, original and Rust interleaved).” Reversibility is built in at every step: FAST_ANYTHING_DISABLE=1 runs the original Python any time, and fast-anything disable fuzzy.find_duplicates removes the marked block byte for byte. Every port shares one .fast/target cache, which you can delete whenever you like with fast-anything clean.
9. When to use this vs alternatives#
| Approach | When it wins | What it costs |
|---|---|---|
| fast-anything | A few deterministic, data-crunching functions dominate; you want proof the replacement is identical | Rust toolchain; one small crate per function; agent or hand-written port |
| Full rewrite in Rust | The whole program is the bottleneck and the team already knows Rust | Months; minute-long compiles; the entire codebase changes hands |
| Cython / Numba | Numeric loops where annotations or JIT compilation are enough | Type annotations or JIT warm-up; no behavioral proof step |
| PyPy | Long-running pure-Python programs with no C-extension dependencies | Compatibility limits; no per-function targeting |
| Just optimize the Python | The algorithm is wrong, not the language (this example is O(n²) pairwise comparison) | Often the right first move — but it caps out where the language does |
fast-anything is the wrong tool when the bottleneck is I/O, when the hot function is non-deterministic, or when the function’s inputs aren’t plain data — scan will tell you that itself, with a reason per function, which is more useful than a silent failure. It is also the wrong tool for a function so small that the FFI crossing costs more than the work saved; verify measures per-call time and refuses to enable those. And it only ports top-level, deterministic functions that take plain data (numbers, strings, lists, dicts, typed arrays), including ones in the entry script when the main code sits under if __name__ == "__main__":. The MCP server built into the binary (fast-anything mcp, eight tools from fast_scan to fast_report) and the Claude Code plugin cover the same loop from inside an agent session.
10. The takeaway#
The loop is short enough to memorize: doctor to check the toolchain, scan to find the hotspot, port to record real calls and generate the crate, verify to prove the port identical on recorded and derived cases, enable to swap it in, bench to measure the whole app interleaved. On the project’s own example that loop turned 20.21 seconds into 269 milliseconds, with the output unchanged and the original Python still in the file behind an environment-variable escape hatch.
The reason the tool is getting attention is not the speedup number. It is the verification step: recorded real calls plus derived edge cases, answered by the original, with nothing enabled until every case matches. Porting to Rust has always been a judgement call about whether the new code still does the same thing. fast-anything turns that judgement into a replay you can run — and the replay is what makes a 75× claim worth believing.