Don't Rewrite Your Entire App in Rust—Just Rewrite That 5%
This tool automatically profiles your Python, Node, or Ruby app, hands the most time-consuming functions to an AI agent to port to Rust, verifies them with 500 real calls, swaps them in with one command, and delivers up to 116x speedups.
When people see the slogan 'Rewrite everything in Rust,' many are already fed up: compiles take minutes, target directories take gigabytes, and refactoring takes months. But when an app gets slow, it is usually just a few functions. fast-anything's idea is to rewrite only the slowest 5% in Rust.

Two days after launch, the project has 2,000+ stars on GitHub and is MIT-licensed. It first profiles your app to find the most time-consuming functions, then has Claude Code or Codex port those functions to Rust, verifies them with real calls, and finally swaps them back into the app.
Installation:
npm i -g @el4cteo/fast-anything
# 或
cargo install fast-anything
Run the entire workflow with one command:
fast-anything go --agent claude -- python app.py
--agent can be replaced with codex, or any AI agent that can read from stdin.

Specific steps:
| Command | What it does |
|---|---|
| scan | Analyze the app and rank functions by time cost and portability |
| port | Record up to 500 real calls, generate a single-function Rust crate and TASK.md |
| verify | Compile and replay all calls to prove outputs match |
| enable / disable | Swap in or roll back the Rust implementation, restoring byte-for-byte |
| bench | Compare overall performance of the original and Rust versions |
| report | Generate markdown and SVG report cards |
Verification is mandatory. In the author's demo, 148 real calls caught an error in a port that looked correct; the cause was that the code compared bytes rather than characters. fast-anything additionally generates edge cases: NaN, ±infinity, -0.0, zero, ±1, non-ASCII text, empty input, and inputs up to 16x larger. It also generates random small slices. It is enabled only if all cases match, and errors must match as well. If the Rust version is slower than the original on every call, it also won't be enabled. Set FAST_ANYTHING_DISABLE=1 to fall back to the original at any time.

The author's benchmark data on an i5-10500 (C/C++ on a GitHub Actions Linux runner):
| App | Before optimization | After optimization |
|---|---|---|
| Python fuzzy deduplication (700 names) | 4.91s | 42ms, 116x |
| TypeScript fuzzy deduplication (2,000 names) | 3.11s | 155ms, 20x |
| PHP fuzzy deduplication (600 names) | 2.94s | 53ms, 55x |
| Go fuzzy deduplication (3,000 names) | 3.02s | 144ms, 21x |
| Ruby fuzzy deduplication (400 names) | 3.13s | 228ms, 14x |
| C# fuzzy deduplication (4,000 names) | 4.03s | 312ms, 13x |
| Java fuzzy deduplication (4,000 names) | 3.50s | 1.18s, 3x (the function itself is 11x; the rest is JVM startup) |
| C mandelbrot | 431ms | 127ms, 3.4x |
| C++ fuzzy deduplication (6,000 names) | 3.02s | 1.09s, 2.7x |
Note that fast-anything tries to port the outermost loop rather than small inner functions that are called repeatedly. This way the app crosses the Rust boundary once, rather than millions of times. The author notes that when porting only the inner Levenshtein function, speedups ranged from 1.9x to 35x, but choosing the outermost loop is more stable.
Why not just rewrite everything?
- Compile time: a single-function crate takes seconds.
- Caching: all ports share a single .fast/target directory; delete it whenever you want.
- Risk: the original code is unchanged; Rust is selected per function and validated against real behavior.
Supported languages: Python, JS/TS (Node/Bun/Deno), Ruby, Java/Kotlin, Go, PHP, C/C++, C#/.NET, and R. Through the C bridge, Ruby, Java, Go, and others do not require extra header files.
This approach has clear boundaries: it can only handle deterministic, pure functions. Someone in the comments asked how to replay-verify functions with side effects; the answer is that you can't, because the results depend on external state. So such functions are out of scope.
If you're struggling with app performance, try optimizing only the slowest 5% instead of rewriting everything. Project URL: https://github.com/EL4CTEO/fast-anything
发布时间: 2026-11-23 17:39