Rewriting an entire application in Rust for performance is costly, slow, and rarely necessary. Most apps spend 95% of their runtime in just 5% of the code. The open-source tool fast-anything by EL4CTEO exploits this reality: instead of a full rewrite, it identifies the slowest functions, ports only those to Rust, and validates they behave exactly like the original.
The process starts with profiling. Running fast-anything scan -- python app.py (or Node, Ruby, PHP, Go, Java, C/C++, C#) records real execution paths and ranks functions by runtime impact and portability. It then isolates the hottest function and records up to 500 real-world calls. A coding agent — such as Claude, Codex, or any stdin-accepting LLM — receives a TASK.md specification to generate a Rust implementation.
Precision porting, not full rewrites
Each port is a minimal Rust crate with a single C-compatible entry point, using JSON for data exchange. This design ensures compatibility across all supported runtimes: Python (via PyO3), Node (napi-rs), Ruby (Fiddle), Java (FFM API), Go (cgo), PHP (FFI), and C/C++/C# (native loaders). No custom bindings are needed — the bridge is universal. The tool compiles the port in seconds, not minutes, and caches builds in .fast/target, which can be safely deleted.
Crucially, fast-anything does not assume correctness. Before enabling the Rust version, it runs verify, replaying all 500 recorded calls. It also generates edge cases: NaN, ±0.0, ±1, non-ASCII strings, empty and oversized inputs, and random shrunk variants. The port must match the original on values (floating-point within 1e-9), error types, and error timing. Even a byte-vs-character comparison bug — which failed 148 of 500 calls — is caught before deployment.
Safety, reversibility, and real gains
The tool ensures zero risk to the original codebase. Enabling a port with enable swaps in the Rust function at runtime, replacing only the marked block byte for byte. The original remains intact and can be restored instantly with disable. Setting FAST_ANYTHING_DISABLE=1 forces the original path at runtime.
Benchmarks from real runs on an i5-10500 show dramatic improvements: a Python fuzzy dedupe went from 4.91s to 42ms (116×), TypeScript from 3.11s to 155ms (20×), and PHP from 2.94s to 53ms (55×). Even C saw a 3.4× gain in a Mandelbrot test. The Java case improved 3× overall — but 11× in the function itself, with the rest limited by JVM startup.
What it means for UK, UAE, US, and Qazaqstan tech teams
For startups and enterprises in the UK, UAE, US, and Qazaqstan, this approach reduces dependency on full-stack rewrites and expensive engineers. Teams can retain their existing codebases — often in Python or Node — while achieving near-native performance where it matters. The tool supports Intel oneAPI on Windows and integrates with Claude Code via plugin or MCP server, enabling AI-assisted porting in secure environments.
Unlike full rewrites, this method preserves business logic, reduces testing overhead, and avoids months of development. It’s ideal for latency-sensitive services in fintech, logistics, or public-sector apps where performance and correctness are non-negotiable.
The MIT-licensed tool is language-agnostic in practice: any runtime that can call C functions can participate. It currently supports top-level, deterministic functions with plain data — no classes, state, or side effects. The scan command explains why other functions aren’t portable yet.
Organisations should evaluate fast-anything for targeted optimisation, especially where AI agents can automate the porting loop. The integration with Claude, Codex, and Cursor via MCP tools (e.g. fast_port, fast_verify) makes it suitable for automated CI pipelines.
The approach aligns with sustainable engineering: maximise benefit, minimise cost and lock-in. By focusing only on the critical path, teams retain control over their tech stack while cutting latency and infrastructure costs.