我周末花了一些时间测试 Bun 的 AOT 编译器,结果令人惊叹。性能提升 2-3 倍,内存使用减少一半以上。
产品与工具 · 2026/10/27
作者在周末测试了 Bun 的 AOT 编译器,结果显示性能提升 2-3 倍,内存使用减少一半以上。Jarred Sumner 指出,Bun AOT 还引入了 `--trim` 选项,可从编译后的二进制文件中删除未使用的 Bun 部分。在 macOS 上,使用 Bun.serve 的 HTTP 服务器的二进制文件从 89 MB 减小到 25 MB。
Bun AOT 编译器在性能和内存方面表现出显著提升,同时通过 `--trim` 大幅减小二进制体积,对于关注 JavaScript 运行时性能的开发者具有重要参考价值。
I spent some time on the weekend to test bun's AOT compiler and results are nothing short of amazing. Performance up 2-3x, memory use less than half.<hr />Jarred Sumner: Bun AOT also introduces `--trim` which deletes unused parts of Bun from the compiled binary
On macOS, a binary that uses Bun.serve’s HTTP server goes from 89 MB to 25 MB
![]()