Rust 重写 Node 工具链,提速 24 倍
推荐指数 52.0 NO. 019 · 2026.06.25
发布2026/06/24Score147Comments37
为什么值得看
Nub 用 Rust 构建了一套 Node.js 工具集,直接复用 stock Node 而非替换运行时,覆盖运行、包管理、脚本执行和版本管理。对厌倦 Bun 生态割裂但又想要高性能 DX 的团队,这是零迁移成本的替代方案。
编辑判断
Bun 的最大阻力从来不是性能,而是兼容性和生态割裂——你需要改 Dockerfile、CI 脚本、调试工具链。Nub 的聪明之处在于锚定 stock Node,用 Rust 只做"工具层加速",规避了运行时替换的政治风险。
之前这个赛道有 tsx、dotenv-cli、volta、fnm 等碎片化工具,Nub 试图用统一 CLI 收编。但真正的考验是 pnpm 的依赖树优化和 Corepack 的博弈,2.5x install 提升在 monorepo 场景下是否成立需要实测。
如果你团队还在 node + tsx + pnpm + fnm 的拼盘配置里挣扎,Nub 值得作为单一工具链试点,尤其适合想保留 Node LTS 稳定性又馋 Bun 速度的基建团队。
社区反馈
正面 37 条评论
核心争论:Nub 以零迁移成本实现 Node 工具链 Rust 化,能否在 Bun 生态割裂与原生性能间找到可持续定位
相关内容
性能提升 40 倍!我们用 Rust 重写了自己的项目 介绍使用 Rust 重写 KCL 项目的过程,Python 程序启动慢、性能不足,Rust 带来内存安全和接近 C/C++ 的性能优势。 仅用一个技巧,让 JavaScript 性能提速 500% 提出不改动 Node.js 架构,将 CPU 密集型代码用 Rust 重写并集成到 npm 的"借刀杀人"策略。 2026 年,Rust 彻底接管 JavaScript 前端工具链 前端工具集体转向 Rust,打包工具提速 5-30 倍,Lint 提速 50-100 倍,内存占用降低 3-4 倍。 比 FastAPI 快 3 倍,比 Babel 快 20 倍:Rust 重写的项目有多强 介绍 Rolldown 用 Rust 重写提升前端构建速度,以及 Ruff 等 Rust 重写工具的性能优势。
Colin here, creator of Nub. I’ve had the general shape of this in mind for years. Nub runs your code with stock `node`, augmented with a `--require` preload hook[0] that adds a transpiler (oxc-powered, packaged as a Node-API add-on), registers a module resolution hook[1], and injects polyfills as ne
I saw this on twitter and loved it, such a good move on your part Colin. Hope the project picks up tons of steam!
I’m surprised to see this using a `--require` hook (rather than `--import`). Maybe something’s changed significantly since I was looking into building some similar functionality… but it makes me wonder about nuances in nub’s ESM support. (When I was investigating this it was very early in Node’s `--