Zhidaily AI · Intelligence · Daily
Zhidaily
Issue 24 · November 23, 2026 · Mon
Today's stories
4 stories · 3 companies
Home / November 23, 2026 / fast-anything ports only the slowest 5% of code to Rust
← Back
Release News Score63

fast-anything ports only the slowest 5% of code to Rust

In brief
An open-source tool narrows "rewrite it in Rust" down to rewriting only the slowest functions: first measure the hot spots, then have a coding agent port them, and enable the port only after replaying real calls confirms it matches.
Hacker News BaselAshraf81 · Hacker News · github.com
Nov 22 · 12:10 Read the original ↗
01Summary

The author released an open-source tool called fast-anything, whose idea is not to rewrite the whole application but to port only the functions that profiling flags as hot spots into Rust. The flow has five steps: scan ranks functions by time cost and portability; port records up to 500 real calls and generates a single-function Rust crate plus a task description; verify replays those calls against a release build; enable/disable switches with one command; bench compares overall timings. A port that fails verification is not enabled: besides recorded calls, it also auto-generates edge cases such as NaN, ±infinity, -0.0, non-ASCII text, empty input and input scaled up 16 times, with the original implementation supplying the answers; floating-point error must stay within 1e-9, and wherever the original errors the port must error too. A port that is slower than the original on a single call is also not enabled. The author gives measurements on an i5-10500: Python fuzzy deduplication drops from 4.91 seconds to 42 milliseconds, PHP from 2.94 seconds to 53 milliseconds, Java is only 3 times faster because of JVM startup, and C++ is 2.7 times faster. It supports Python, JS/TS, Ruby, Java, Go, PHP, C/C++ and C#, installs via npm or cargo, and is MIT licensed. The limits are that it can only port top-level functions that take plain data and are deterministic, and that these numbers come from the author's own examples with no third-party reproduction.

02Background

Rewriting an entire project in Rust usually takes months, compiles slowly and produces large binaries; but most of a program's runtime is concentrated in a few functions. fast-anything turns this common knowledge into a process: measure first, then change only those few places, leaving the rest of the code as it is.

03Impact

For teams already running services in Python, PHP, Ruby and the like, this means they can try it on a single function first and fall back to the original implementation at any time with FAST_ANYTHING_DISABLE=1 or the disable command, without taking on the risk of a full rewrite. The cost is bringing in the Rust toolchain and a layer of cross-language calls, and it only applies where hot spots are concentrated and the function's inputs and outputs are plain data; if the bottleneck is spread across the system, the gains shrink noticeably.

04Discussion

Some commenters argue that rewriting in the same language with hindsight is itself enough to make things much faster, and that switching languages is incidental; others point out that these portable hot spots tend to be low-hanging fruit, while the real performance cost is spread through the system like sand. Another developer mentions that only after rewriting did they discover that libraries like psycopg2 are already C underneath and about as fast as Rust, and that the motive for rewriting was more that the code has to run on customer machines and they did not want to expose the implementation.