Fast-Anything: AI-Ports Your Slowest 5% to Rust, Verified by Real Call Replay (116x)
Fast-Anything is an open-source CLI tool that uses AI agents to port only the hottest, pure functions from Python, Node, Ruby, etc. to Rust, verifies correctness by replaying up to 500 real calls plus edge cases, and enables reversible, per-function Rust crates—delivering up to 116x speedups while avoiding full rewrites.
Reading font

Why Not Rewrite the Whole App in Rust
Rewriting an entire application in Rust brings months of effort, minute-long compiles, and multi-gigabyte target directories. Fast-Anything takes a different approach: 95% of runtime is spent in a few hot functions. The tool identifies those functions, lets an AI agent (Claude Code or Codex) port only them to Rust, then verifies the port by replaying real calls.
Seven-Command Pipeline
The workflow is a chain of seven commands: scan – profiles the running application to find hotspot functions. port – invokes the AI agent to generate a Rust port of the selected function. verify – replays recorded real calls (up to 500) plus generated edge cases, comparing results byte-for-byte. enable / disable – swaps the original function with the Rust version or reverts it. bench – runs before/after benchmarks and reports speedup. report – outputs a detailed verification and benchmark report. doctor – checks that Rust toolchain, runtime, and agent are correctly installed.
The verify step is the key differentiator: most AI rewrite tools lack a gate that proves the new code behaves identically.
Port the Outer Loop, Not the Inner Function
Naïve porting targets the innermost hot function (e.g., a Levenshtein distance routine). That forces a cross-language call on every iteration—millions of FFI transitions. Fast-Anything instead ports the entire outer loop that contains the hot function, so the application crosses into Rust only once.
Official docs show the difference on a Python fuzzy-deduplication task:
Porting only the inner levenshtein: 35× and 1.9× speedups.
Porting the outer loop: 4.91 s → 42 ms ( 116× ).
PHP version: 2.94 s → 53 ms ( 55× ).
The gap is entirely due to eliminated FFI call overhead.
Strict Function Eligibility
Only top-level, deterministic, pure-data functions qualify: inputs and outputs must be JSON-serializable (numbers, strings, lists, dicts). Functions using randomness, timestamps, global state, or I/O side effects are rejected by scan with a reason. This makes the tool suitable for CPU-intensive computations (string processing, numeric algorithms, encoding/decoding, image ops) but not for glue code that calls databases or HTTP services.
Verification by Real-Call Replay and Edge-Case Generation
During port, the tool records up to 500 actual invocations. verify then:
Replays every recorded call with a release-build Rust binary, comparing results exactly.
Generates adversarial edge cases: NaN, ±infinity, negative zero, non-ASCII text, empty inputs, and 16× larger inputs—feeding each to both original and ported functions.
Anti-cheating: one in five recorded calls is withheld from the agent; if the port passes only the seen inputs, it fails.
Float tolerance is 1e-9; negative zero must not masquerade as positive zero.
If the Rust version is slower than the original (FFI cost exceeds compute savings), it is rejected.
One case study: a port appeared correct but compared bytes instead of characters; 148 of 500 real calls exposed the bug.
Reversible, Per-Function Crates
Each ported function becomes an independent single-function Rust crate. Benefits:
Compilation takes seconds, not minutes.
All crates share a .fast/target cache directory; fast-anything clean removes it.
Switching is bidirectional: enable inserts the Rust implementation, disable restores the original byte-for-byte.
Environment variable FAST_ANYTHING_DISABLE=1 forces the original code at any time.
Reversibility assumes the original source remains unchanged; editing the function while enabled causes drift and requires a new port.
Known Limitations
Capability boundary: Only helps CPU-bound pure functions. Network, database, or file I/O bottlenecks are unaffected.
Engineering maturity: Six-day-old repository with 17 tags; commands, parameters, and behavior change rapidly. Not yet stable for production pipelines.
Cost and dependencies: Requires Rust toolchain ( rustup) and an AI agent (Claude Code/Codex). Porting consumes agent tokens—it trades manual FFI effort for token spend.
Installation and First Run
Prerequisites: Node 22+ (or Cargo), working Rust toolchain, and a coding agent that reads from stdin. npm i -g @el4cteo/fast-anything (or cargo install fast-anything) fast-anything doctor – validates environment. fast-anything go --agent claude -- python app.py – replace python app.py with your actual command (Node: -- node app.ts, Ruby: -- ruby app.rb, etc.). --agent accepts claude, codex, or any stdin-reading command; omitted, it writes a TASK.md for manual agent use.
After go completes, check bench output for before/after columns and a concrete speedup (e.g., 4.91s → 42ms).
Common Pitfalls
PHP: must enable extension=ffi in php.ini; otherwise scan fails immediately.
Java: requires JDK 22+. doctor checks versions but not CPU architecture. Mixing x86_64 Python with arm64 Rust causes dlopen failure at enable; align architectures beforehand.
With a ready environment, a benchmark report appears in ~10 minutes; fully porting and verifying a function with edge cases typically takes an afternoon.
Author's Take
The author evaluates such tools by whether they replace the manual profile → handwrite FFI → write correctness tests loop. Fast-Anything automates the middle: scan finds the hotspot, the agent writes the port, verify proves correctness, bench delivers numbers.
Recommendation:
Teams running Python/Node/PHP with a known CPU-bound function: try it—porting that function likely yields a surprise speedup.
Teams whose bottlenecks are network/database, or who cannot identify a compute-heavy pure function: skip it; the toolchain adds maintenance burden without benefit.
GitHub repository: https://github.com/EL4CTEO/fast-anything
For questions about attribution, corrections or content rights, please contactand we will review it promptly.