Claude Code现在使用Rust编写的Bun

Hacker News Top 新闻

摘要

Claude Code,Anthropic的AI代码助手,已开始使用Rust移植的Bun作为其JavaScript运行时,使得在Linux上的启动性能提升了10%,尽管这一变化并未引起太大关注。文章确认,通过嵌入的Rust源文件,Claude Code二进制文件中使用了Bun v1.4.0。

暂无内容
查看原文
查看缓存全文

缓存时间: 2026/07/20 09:47

# Claude Code 现已使用 Rust 编写的 Bun 来源:https://simonwillison.net/2026/Jul/19/claude-code-in-bun-in-rust/ 2026年7月19日 在《用 Rust 重写 Bun》(https://bun.com/blog/bun-in-rust)一文中,Jarred Sumner 声称: > Claude Code v2.1.181(于6月17日发布)及后续版本使用了 Bun 的 Rust 移植版。Linux 上启动速度提升了10%,但除此之外几乎没有人注意到。无聊是好事。 我决定查看自己的 Claude Code 安装,看看能否找到它使用 Rust 编写的 Bun 的证据。 我认为以下两个命令很有说服力: `` strings ~/.local/bin/claude | grep -m1 'Bun v1' `` 对我而言,输出结果为 `Bun v1.4.0 (macOS arm64)`。Bun 在 GitHub 上的最新发布版本(https://github.com/oven-sh/bun/releases)目前是 5月12日的 v1.3.14(https://github.com/oven-sh/bun/releases/tag/bun-v1.3.14)。因此,Claude 中的 v1.4.0 版本号支持了他们发布尚未发布的 Bun 预览版的说法。 (**更新**:Rust 版本*已经*作为 Bun canary(https://bun.com/docs/installation#canary-builds)发布——运行 `bun upgrade --canary` 将安装此版本(https://github.com/oven-sh/bun/releases/tag/canary)。) `` strings ~/.local/bin/claude | grep -Eo 'src/[[:alnum:]_./-]+\.rs' `` 这将输出 563 个文件名(https://gist.github.com/simonw/c92fb0f67b114ac26e3b95a09ddccfdc)的列表,以这些开头: `` src/runtime/bake/dev_server/mod.rs src/runtime/bake/production.rs src/bundler/bundle_v2.rs `` 看起来 Bun 的 Rust 版本确实在数百万台不同设备上投入生产运行。正如 Jarred 所说,“无聊是好事”。 **更新**:这是来自 Ajan Raj(https://twitter.com/ajanraj25/status/2078825794701242697)的一个巧妙技巧: `` cat > /tmp/bun-version.ts <<'EOF' console.log("embedded bun:", Bun.version); process.exit(0); EOF BUN_OPTIONS="--preload=/tmp/bun-version.ts" claude --version `` 对我而言,这输出 `1.4.0`。 这里是 5月17日的提交(https://github.com/oven-sh/bun/commit/b18bf6d1d0a92238f240bfd125f0e3b3461b9243#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519),它将 `package.json` 中的版本更新为 1.4.0。此后该版本未再更改,但也尚未纳入 `canary` 之外的标记版本中。

相似文章

Claude Code现在使用Rust重写的Bun

Simon Willison's Blog

Claude Code v2.1.181及以上版本使用了Bun的Rust移植版,在Linux上启动速度提升了10%。有证据显示它附带的是Bun v1.4.0的预览版。

Bun 已转换为 Rust。接下来怎么办?

Hacker News Top

Anthropic 收购了 Bun,并使用 Claude Code 智能体在九天内将整个运行时从 Zig 重写为 Rust。该重写通过了 99.8% 的测试,但引入了超过 10,000 个 unsafe 块,引发了对内存安全性益处的质疑。

Bun 的 Rust 重写已合并

Lobsters Hottest

Bun,JavaScript 运行时和包管理器,已合并其核心从 Zig 到 Rust 的重写,可能提升性能和可维护性。