EL4CTEO/fast-anything · 23 Nov 2026 · Feature

The Rust rewrite, shrunk to one function at a time

fast-anything profiles an app, has a coding agent port only the hot functions to Rust, and proves the port against real recorded calls before anything gets swapped in.

“Have you considered rewriting it in Rust” has spent a decade as the tech industry’s favorite joke answer, the cold-shower advice of programming forums. The joke works because the underlying claim is often true and the cost of acting on it is absurd: months of work, minute-long compiles, a team that now maintains two codebases. fast-anything, a tool by EL4CTEO that hit the Hacker News front page with 180 points and 151 comments, takes the claim seriously while refusing the cost. Its pitch, printed right under the wordmark: don’t rewrite it in Rust, rewrite the 5% that’s slow.

EL4CTEO/fast-anything

The tool is a supervisor for partial rewrites. It profiles a running application, ranks functions by time spent multiplied by how portable they are, and then hands a coding agent a task file describing exactly one function to port. The agent writes a one-function Rust crate. The tool then release-builds that crate and replays every call it recorded from the original program against the Rust version, checking that outputs match. Only after that does it splice the Rust into your source, inside a marked block that can be removed byte for byte later.

That last clause is doing a lot of work. The whole pitch rests on reversibility: your code stays as it was, the Rust is opt-in per function, and an environment variable forces the original implementation at any time. A rewrite you can undo for the price of deleting a marked block changes the risk calculus in a way a full port never can.

The boring part is the bridge

The technically interesting decision is how the Rust talks to everything else. Python gets PyO3 and JavaScript gets napi-rs, the conventional native-module routes. Everything else, which is to say Ruby, Java, Kotlin, Go, PHP, C, C++, C#, and R, goes through one shared mechanism: a plain Rust library exposing a single C entry point that takes and returns JSON. Each language then calls that entry point through whatever FFI machinery it already ships. Ruby uses its built-in Fiddle. Java 22+ and Kotlin go through the FFM API. Go uses dlopen via cgo, PHP its FFI extension, C# NativeLibrary, R the base .C() interface. No headers, no per-language binding generators, no extra tools to install.

This is unglamorous and it is the reason the project covers eleven languages instead of two. JSON over the C ABI is slow relative to a purpose-built binding, and the README is candid about the consequence: a port that is correct but slower per call than the original, because calling into Rust costs more than the work saved, gets refused. The tool measures that and declines to enable it. Glue code with a speedometer, and the honesty to say no.

There is a second, subtler design choice worth flagging. fast-anything ports the outermost loop it can rather than the tiny function inside that loop, so the application crosses into Rust once instead of millions of times. The README quantifies the difference on its own examples: porting only the inner Levenshtein distance function yielded 35× in one case and 1.9× in another, while porting the enclosing loop delivered the headline numbers. Anyone who has watched a Python-to-C extension lose its speedup to per-call marshalling will recognize this as the correct call, and it is the kind of judgment that separates tools built from experience from tools built from a demo.

Proof, not vibes

The verification loop is where the project earns its keep, and the README knows it, titling the section “Proof, not vibes.” During the porting phase the tool records up to 500 real calls to the target function from your actual workload. Verification then replays every recorded call against the release-built Rust and compares results: same values, with floats tolerated to within 1e-9, and errors raised wherever the original raised errors.

Recorded calls alone would be thin coverage, so the tool also derives additional cases and lets the original implementation answer them: edge cases like NaN, positive and negative infinity, negative zero, empty inputs, non-ASCII text, inputs up to 16× larger than anything recorded, plus shrunk inputs in the style of property-based testing. The README’s showcase example is a port that looked correct and compared bytes instead of characters. 148 of the 500 recorded real calls caught it.

This is differential testing with the original code as the oracle, and it is the right shape of safety net for agent-written code. An LLM porting a function will produce something plausible; plausible is precisely what recorded-call replay is built to puncture. The approach has known limits, which the design implicitly acknowledges: it can only prove equivalence on inputs resembling those seen or derived, and it only attempts deterministic functions taking plain data (numbers, strings, lists, dicts, typed arrays). Anything with side effects, hidden state, or exotic types stays put, and the scan command is documented to explain why a given function can’t move yet.

The numbers, and what they measure

The reported results come from real runs on an i5-10500 under Windows 11, with the C and C++ numbers taken on a 4-core GitHub Actions Linux runner, all reproducible from the repo’s examples directory. A Python fuzzy-deduplication script over 700 names went from 4.91 seconds to 42 milliseconds, a 116× speedup. TypeScript over 2,000 names hit 20×, PHP 55×, Go 21×, Ruby 14×, C# 13×. The Java result is the honest outlier: 3× on the whole app, 11× on the function itself, with the gap attributed to JVM startup time, which no amount of Rust inside your hot loop will fix. C and C++ show the smallest gains, 3.4× and 2.7×, which is what you expect when the baseline is already compiled native code.

These are the project’s own benchmarks on its own examples, and the README presents them as such. The pattern across languages is nonetheless informative: the interpreted languages gain the most, the JIT-compiled ones a middle band, and the already-compiled ones the least. That gradient is consistent with the tool doing what it claims rather than gaming the measurement, though the examples are fuzzy deduplication and Mandelbrot, workloads chosen to be CPU-bound and portable. Your web framework’s request handler is a different animal.

The skepticism, and whether it lands

The Hacker News thread pushed back on the premise more than the implementation. The top visible comment argues that most codebases could get dramatically faster rewritten from scratch in the same language, because rewrites benefit from hindsight: better data structures, less bloat, slow parts offloaded from the start. In that view, the speedup attributed to Rust is often the speedup of making better decisions, and the language is a passenger. Walter Bright, of D language fame, made a related observation in the thread: original design and data-structure choices persist for decades because their tendrils reach everywhere, and reorganizing them is impractical.

Both critiques are fair, and neither quite defeats the tool. fast-anything does not promise a redesign; it promises a like-for-like translation of specific functions, verified against recorded behavior. If the honest answer for a given codebase is “your algorithm is bad, not your language,” the tool’s own verification step will report that the Rust port gained little, and its per-call cost check will refuse to enable ports that don’t pay for themselves. The broader debate, echoed in a language-comparison piece arguing that architecture and caching routinely outweigh raw language speed, applies to any performance work, this tool included.

The context that makes the project timely is the agent ecosystem it targets. A Medium post about a full Python-to-Rust microservice rewrite, and a YouTube video of Claude Code rewriting Python in Rust for a 3.4× gain, both describe humans or agents doing by hand what fast-anything automates and, crucially, checks. The tool ships as a Claude Code plugin, an MCP server with eight tools exposed for Claude Code, Codex, and Cursor, and a skill file that teaches any agent the scan-port-verify loop. The --agent flag also accepts any command that reads a prompt from stdin, so it is not locked to one vendor. The unspoken thesis is that coding agents have made small, mechanical, well-specified ports cheap, and that the missing piece was a harness that specifies the port, captures the behavior, and audits the result.

Where it stops

The boundaries are clearly drawn in the README, which is more than most hyped repos manage. Only top-level, deterministic functions with plain-data arguments are candidates: module-level functions and static methods in Python, static methods in Java, C#, and PHP, plain functions in Go, free functions in C and C++. SYCL kernels running on a device are excluded, and under the SYCL compiler flag only host functions get profiled. Windows users with Intel oneAPI need an environment where the linker setup has run. The Java numbers expose the ceiling of the whole approach: when runtime startup dominates, porting hot code moves the needle barely at all.

The open question is durability. A codebase with a dozen verified Rust ports embedded in marked blocks is a polyglot system held together by one tool’s bookkeeping, and the project is young enough that its own issue tracker will tell you whether that arrangement survives contact with real teams, refactors, and CI. The shared build cache and the one-function-crate design keep compile times in seconds, which removes the most common Rust complaint, but the deeper question, whether partial ports age better than full rewrites or worse, has no answer yet in the sources.

What fast-anything represents, regardless of how it fares, is a shift in what “rewrite it in Rust” costs. The joke answer assumed the rewrite was the unit of work. Here the function is, an agent does the typing, recorded behavior does the auditing, and the whole thing uninstalls cleanly. The meme finally got a toolchain.

Sources

  1. Fasting: What You Should Know
  2. Use Cases for Node and Rust comparison
  3. Python to Rust Rewrite: What 30 Days in Production Showed
  4. Types of Fasting - 11 Popular Methods You Should Know
  5. Beyond Syntax: A Research-Driven Showdown of Python, Node.js, Go ...
  6. I was told at work to re-write a Rust program in Python
  7. 11 Effective Ways to Fast without Giving up Food - ParticularlyCALLED
  8. Rust: Python's New Performance Engine
  9. Fast-Anything: Don't rewrite it in Rust. Rewrite the 5% that's slow
  10. Intermittent Fasting: What Is It, And How Does It Work?
  11. Go -> Rust -> Python for backends with time to market constraint : r/golang
  12. I Let Claude Code Rewrite Python in Rust (3.4x Faster)

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.