Fast-Anything: Don't rewrite it in Rust. Rewrite the 5% that's slow github.com ·...
HN Best 200 @best
Fast-Anything: Don't rewrite it in Rust. Rewrite the 5% that's slow github.com · 10 points · 1 comments · HN thread
TL;DR fast-anything is a tool that profiles an application, ranks its functions by runtime and portability, has a coding agent port only the hottest portable function to Rust, verifies the port against recorded real calls plus derived edge cases, and swaps it in with one reversible command. The README reports speedups of 2.7x to 116x on fuzzy-dedupe and similar benchmarks across Python, TypeScript, PHP, Go, Ruby, Java, C and C++.
- Targets the 5% of code where most runtime goes, instead of rewriting the whole app in Rust.
- Records up to 500 real calls, then replays them and derived edge cases (NaN, infinities, empty and large inputs) against the Rust port; nothing is enabled until all cases match.
- Refuses to enable a port that is correct but slower per call than the original, because crossing into Rust can cost more than the work saved.
- Ports the outermost loop rather than a tiny inner function, so the app crosses the language boundary once; the README says porting only the inner levenshtein gave 35x and 1.9x.
- Supports Python, Node/TypeScript, Ruby, Java, Go, PHP, C and C++, with a Claude Code plugin, an MCP server and a skill for agents.
- Benchmarks are on an i5-10500 under Windows 11, except C and C++ which ran on a 4-core GitHub Actions Linux runner; the README says they can be reproduced from examples/. MIT licensed.
Discussion The thread is very small, with a single comment. It is a brief, friendly reaction that points to a related project, action-validator, which reportedly distributes Rust code on npm by compiling it to WebAssembly. The commenter says they had been thinking about a similar idea. There is no debate about the tool's approach, benchmarks or verification method.
- Interesting; Rust can be shipped via npm through WebAssembly (a few): The only commenter notes that action-validator distributes Rust projects on npm by compiling to wasm, a distribution route related to what fast-anything does. They say they had considered a similar idea themselves.
#Rust #Performance #Profiling #WebAssembly #CodingAgents #DevTools