← Sun, Nov 22 digest

Fast-Anything: Don't rewrite it in Rust. Rewrite the 5% that's slow

read article ↗ hn thread ↗

fast-anything is a CLI tool that uses coding agents to profile applications, rewrite performance bottlenecks into verified Rust modules, and plug them in via FFI.

summary is enough The tool's concept and multi-language FFI integration are interesting, but the readme's benchmarks and usage instructions are self-explanatory.

summary

fast-anything automates the process of extracting performance bottlenecks from various languages like Python, TypeScript, and Go, porting them to Rust via AI coding agents, and verifying behavior against real and derived test cases. It uses language-specific bindings like PyO3 and napi-rs to swap the optimized functions back into the original codebase seamlessly. While it yields dramatic speedups for CPU-bound hot paths, it introduces FFI and maintenance complexity.

key points

  1. Profiles applications to identify portable hot paths and ranks them by execution time.
  2. Leverages AI coding agents to rewrite only the targeted functions into standalone Rust crates.
  3. Rigorously verifies correctness by replaying recorded calls and automatically generating edge-case tests before enabling the Rust module.
  4. Supports a wide range of languages including Python, Node.js, Ruby, Java, Go, PHP, and C# using lightweight FFI bridges.

who should read it

Software engineers working with dynamic or interpreted languages who need targeted performance boosts without rewriting entire applications.

discussion positive

consensus

Commenters debate whether performance issues are truly concentrated in a neat 5% or spread thin across the system, though many acknowledge the cleverness of using AI for verified micro-rewrites.

pushback

Some argue that introducing hidden Rust codebases via FFI creates long-term maintenance burdens and technical debt that could be avoided with better data structures or existing libraries.

best comment by ThouYS ↗

neat, but in my experience bottlenecks that you could solve this way are low hanging fruits and optimized away quickly.

the true performance hog is like sand, spread across the system, a little bit in every place.

Points out that true performance bottlenecks are often spread like sand across a system rather than isolated in easily extractable hot paths.

Generated by an LLM from the article and thread. Check the sources before relying on it.