Developer tools

Fast-anything: Targeted Rust ports for slow functions in any language

A new tool profiles apps, uses AI agents to rewrite hot paths in Rust, and verifies correctness with recorded calls before swapping them in.

A magnifying glass highlighting a single gear in a multi-colored machine.
Illustration generated for this article

GitHub user EL4CTEO released fast-anything on November 22, 2026, a command-line tool that identifies performance bottlenecks in applications written in Python, Node, Ruby, Java, Go, PHP, C, C++, C#, or R. Instead of rewriting entire codebases in Rust, the tool isolates specific slow functions, generates Rust equivalents using AI coding agents, and validates them against real-world execution data.

What happened

The project addresses a common dilemma in software engineering: high-level languages offer development speed but often suffer from runtime performance issues in compute-heavy tasks. Rewriting an entire application in a systems language like Rust is resource-intensive, requiring months of work, long compilation times, and significant maintenance overhead. Fast-anything proposes a middle ground by targeting only the critical five percent of code responsible for most of the execution time.

The tool automates the process of finding these hotspots, generating the replacement code, and ensuring behavioral equivalence. It integrates with existing AI coding assistants such as Claude Code, Codex, or Cursor via Model Context Protocol (MCP) servers or plugins. The workflow is designed to be fully reversible, allowing developers to opt in or out of specific optimizations without altering the core logic of their original application permanently.

Installation is straightforward via npm or Cargo, and the tool relies on the user’s existing Rust toolchain for compilation. It supports a wide range of runtimes and build systems, including Maven, Gradle, Bun, Deno, and standard interpreters. The release includes benchmarks demonstrating significant speedups across multiple languages, validating the approach of selective porting rather than full migration.

How it works

Fast-anything operates through a series of discrete steps that profile, port, verify, and swap code. First, the scan command profiles the running application and ranks functions based on execution time and portability. Once a target is identified, the port command records up to 500 real function calls and generates a single-function Rust crate along with a task description for an AI agent. The agent then writes the Rust implementation, which is compiled and tested.

Verification is rigorous. The verify command replays every recorded call against the new Rust function, ensuring outputs match the original within a tolerance of 1e-9 for floats and that errors occur in the same scenarios. The tool also derives additional edge cases, such as NaN, infinity, non-ASCII text, and empty inputs, to catch subtle bugs. If the Rust version is correct but slower due to calling overhead, it is not enabled. The enable and disable commands swap the implementation in or out by modifying a single marked block in the source code.

The technical bridge between the host language and Rust is lightweight. For most languages, including Ruby, Java, Go, PHP, C, C++, C#, and R, the port is a plain Rust library with one C entry point that accepts and returns JSON. This approach avoids the need for complex headers, bindings, or extra tools. Python uses PyO3, while JavaScript and TypeScript use napi-rs. The tool prioritizes porting the outermost loop to minimize the number of crossings between the host language and Rust, which reduces overhead significantly compared to porting inner functions called millions of times.

Key details

  • Supports Python 3.10+, Node 22+, Bun, Deno 2+, Ruby 3.3+, Java 22+, Kotlin/JVM, Go 1.22+, PHP 8.1+, C/C++, C#/.NET 8+, and R 4.0+.
  • Integrates with AI agents via Claude Code plugin, MCP server, or custom skills, accepting prompts on stdin if no agent is specified.
  • Verification includes replaying up to 500 recorded calls plus derived edge cases like NaN, infinity, and non-ASCII text.
  • Benchmarks show speedups ranging from 2.7× for C++ fuzzy dedupe to 116× for Python fuzzy dedupe on an i5-10500 processor.
  • Ports are compiled as single-function crates with shared cache in .fast/target, keeping compile times to seconds rather than minutes.
  • The process is fully reversible with environment variable FAST_ANYTHING_DISABLE=1 forcing the original code path at any time.

Why it matters

For teams building products with AI or managing legacy codebases, this tool offers a pragmatic path to performance improvement without the risk of a full rewrite. It allows engineers to leverage the speed of Rust for specific computational bottlenecks while maintaining the productivity of higher-level languages for the rest of the application. This hybrid approach reduces the barrier to entry for systems programming, as developers do not need deep expertise in Rust to benefit from its performance characteristics.

The emphasis on automated verification addresses a major concern in manual optimization: correctness. By recording real execution traces and deriving edge cases, fast-anything ensures that the optimized code behaves identically to the original under known conditions. This reduces the testing burden and increases confidence in deploying performance-critical changes. The ability to swap implementations in and out also facilitates A/B testing and gradual rollout strategies.

What you can do

  • Install fast-anything globally using npm or Cargo to prepare your environment for targeted optimization.
  • Run the doctor command to check your Rust toolchain, runtimes, and AI agent configurations for compatibility.
  • Use the scan command on your application to identify the top candidates for porting based on execution time.
  • Generate a port for a specific function ID using the port command and review the generated TASK.md file.
  • Verify the new Rust implementation with the verify command to ensure it matches the original behavior on recorded calls.
  • Benchmark the performance difference using the bench command and generate a report for your pull request with report.
  • #rust
  • #performance
  • #ai-agents
  • #optimization
  • #developer-tools

Tools from the Bytechap store

Keep reading

All stories