跪拜 Guibai
← Back to the summary

The 20x Rust Build Speedup That Turned Into a Debugging Marathon

I Switched My Build Tool to Rust for 30x Speed, and the Team Almost Couldn't Work Overtime

Last year, against objections, I led the team's build tool migration from Webpack to Rspack.

The justification was solid: cold start builds dropped from 45 seconds to 2 seconds, HMR went from seconds to milliseconds, and the official benchmark claimed "about 20x performance improvement". Under the banner of "cost reduction and efficiency", this was almost an offer we couldn't refuse.

The migration went more smoothly than expected. Configuration was largely compatible, most plugins switched seamlessly, and the moment the CI pipeline ran clean, I felt I had executed a beautiful infrastructure upgrade.

But the honeymoon from "speed" lasted only a week.

A week later, an urgent requirement was going live, and the build suddenly errored. The error pointed to a CSS parsing issue we had never seen: a historical page had written @media and(max-width: 768px), missing a space. Webpack's minifier had turned a blind eye to this, but Lightning CSS, which Rspack switched to under the hood, judged it invalid syntax and failed the entire build.

Then another module's dynamic import started "silently failing". No error in code, the build passed, but the component on the page didn't render. After a full day of investigation, we found that an old CommonJS dependency, under Rspack's stricter interop rules, had a different default export resolution.

The "historical dust" that Webpack helped you hold together – Rust tools won't hold any of it.

1. You Think You're Buying Speed, But You're Actually Buying Observability

After this incident, I began to re-examine "build speed".

Is the performance bottleneck of a large admin project really just "slow builds"?

There's a sentence in that Juejin performance retrospective article that I didn't pay attention to at the time, but looking back, it's very jarring: most optimizations are "symptom optimizations", not "root-cause optimizations". Shallow techniques like image compression and lazy loading account for less than 20% of large project performance impact; what actually drags down a project is deeper issues like unreasonable architecture, chaotic loading strategies, and redundant build chains.

In other words, Webpack is slow not because Webpack itself is slow, but because the project has accumulated too much unnecessary compilation burden: duplicate polyfills, dead Tree-Shaking, conflicting plugins, and loaders that were written but never used.

Rust tools speed up the execution of these burdens, but they don't remove the burdens themselves.

This is like a congested highway: you swap the toll booth's card reader for ETC, and passage speed does improve. But the broken-down trucks, the lane-changers, and the tractors that shouldn't be on the highway at all – none of them go away. Once a link's tolerance drops (like Lightning CSS's strict syntax checking), the whole road jams even harder.

2. The Rust Toolchain's Hidden Bill: Debugging Costs Double

There's an even more insidious cost: when the build tool itself becomes a black box you're unfamiliar with, the cost of troubleshooting rises sharply.

Webpack's config is long and messy, but its plugin ecosystem and error messages are at least understandable by two or three people on the team. Rspack, Rolldown, and other Rust tools, with their compiled-language internals, naturally have less friendly error stacks than JavaScript tools. One developer put it bluntly: Rust tools' error stacks "are sometimes not as friendly as JS tools, and debugging complex issues still requires a learning curve".

More troubling is the natural gap between Rust tools and the existing JS plugin ecosystem. A custom loader that ran in Webpack for five years may have no corresponding implementation in Rspack. You're not facing "change one line of config", but "rewrite a plugin" or "find a replacement that doesn't exist yet".

A 20x speed boost saves waiting time. But the two extra days spent debugging an unfamiliar error, or the week spent rewriting a loader – none of that shows up on the ledger.

3. Vite 8 Is the Same: Fast Is Real, But the Cost of an Engine Change Is Global

After Vite 8 switched to Rolldown, the situation isn't simpler.

A real upgrade log shows that after upgrading to Vite 8, /@/ path aliases fail directly in the config loader, and the build errors at startup; the object form of manualChunks is completely deprecated and must be changed to a function; some Rollup hooks and legacy plugins are simply not supported under Rolldown.

For new projects, none of these are problems. But for a legacy project that has iterated for three years and accumulated countless "historical idioms", every incompatibility is an archaeological dig. You have to find it, understand why it was written that way back then, and finally fix it without breaking the business.

Rust tools make "building" faster, but they also make "migrating" heavier.

4. So Should You Switch or Not?

My answer has changed.

Switch, but the premise isn't "it's faster" – it's "your engineering debt has been cleaned up enough to survive an engine swap".

If any of the following apply, Rust tools are worth adopting immediately:

But if any of the following apply, please deprioritize the migration:

Final Thoughts

In 2026, the Rustification of front-end tooling is an irreversible wave. Vite 8's Rolldown, ByteDance's Rspack, and Bun's internal rewrite all prove one thing: rewriting JavaScript tools in compiled languages brings order-of-magnitude performance gains, and it's unavoidable.

But between "tools getting faster" and "engineering getting better" stands a wall called migration cost.

Webpack is slow, but its ten years of tolerance helped countless teams hold onto historical debt. Rust tools are fast, but they owe you no favors. They simply follow stricter rules to compile code into output. As for the non-compliant, incompatible, and should-not-exist parts of your code, they won't hide them for you, and they can't hide them.

The first principle of performance optimization is always to figure out where time is actually spent. If it's spent on redundancy, switching engines just speeds up "executing redundancy"; only when it's spent on real computation does Rust's 20x become a true 20x.

Comments

Top 2 from juejin.cn, machine-translated. The original thread is authoritative.

组合搭配函数

"A faster tool doesn't mean a better project" — that hits the point dead on. The 20x speed looks great to watch, but the real bill for the migration comes due afterward. That silent-failure stretch made me break out in a cold sweat; the scariest thing is when it doesn't even raise an error.

mannymu

I just finished migrating from webpack to rspack the day before yesterday. Got it done in a short while with Claude Code, only tripping over one UMD compilation pitfall. The speed is far too much better.