rustified-l10ns — I rewrote a TypeScript tool in Rust and it got 150x faster
A Flutter localization string extractor. Originally TypeScript (30s scan time). Rewrote in Rust (200ms). Here's the before/after, the lessons, and whether it was worth it.
I had a TypeScript tool that scanned Flutter projects for localizable strings. It worked. But it took 30 seconds to scan a 50k-line project. 30 seconds every time you run flutter gen-l10n.
That's too slow. So I rewrote it in Rust.
rustified-l10ns now does the same scan in under 200ms. 150x faster. Here's the story.
what it does
Flutter localization is annoying. You write strings in your widgets, then manually extract them to ARB files. rustified-l10ns automates that — it walks your Dart files, extracts every Text(), label:, hint:, etc., and generates the ARB files.
the TypeScript version
The original was fine architecturally:
// Walk directory
// Parse each Dart file with the AST
// Collect string literals from widget trees
// Deduplicate
// Write ARB
But Node.js + TypeScript is slow at file I/O. 50k lines of Dart across 300 files = 30 seconds. The AST parser (a JS-based Dart parser) was the bottleneck. Each file required spinning up the parser, loading the grammar, and traversing the tree.
the Rust version
Same algorithm, but:
- Parallel file walking — Rayon makes this trivial
- Zero-copy parsing — the Rust Dart parser operates on byte slices, not string copies
- No GC pauses — the 30s scans had visible GC spikes every 5 seconds
- Small binary — 4MB vs 50MB+ with Node + dependencies
// Walk directory in parallel
files.par_iter()
.map(|f| scan_file(f))
.reduce(HashSet::new, |a, b| &a | &b)
That's literally the parallelization. Rayon is magic.
was it worth it?
Honestly? For this specific tool? Yes. Running 150x faster means developers don't context-switch. They run rustified-l10ns as part of their build pipeline and it completes before the next build step even starts.
Would I rewrite everything in Rust? No. The TypeScript version took 2 days to write. The Rust version took 2 weeks. You need to pick your battles.
But for tools that sit in the inner loop of development, the speed difference is quality-of-life changing. 30 seconds of waiting vs. "it's already done" — that's the difference between a tool developers tolerate and one they love.
The repo is on GitHub if you want to check it out: https://github.com/AKhilRaghav0/rustified-l10ns