
上个月,在2026年的Rails World大会上,Ruby on Rails的创造者大卫·海涅迈尔·汉森发表了一场充满乐观情绪的主题演讲。他在演讲中称,人工智能几乎已经消除了开发者手动编写代码的需求。不过,这位在网络上以DHH之名著称的技术大佬或许还不宜立刻删掉自己的代码编辑器。周日,DHH发布了一篇测试报告:他让各类先进的人工智能工具分别用Elixir、Go和Rust三种语言来开发并优化其公司旗下的Campfire群聊应用,随后将这些版本的运行时性能与原版Ruby on Rails实现版本进行了对比。
Last month at Rails World 2026, Ruby on Rails creator David Heinemeier Hansson gave a relentlessly optimistic keynote in which he suggested AI has all but eliminated the need for developers to manually write code. But perhaps DHH, as he is known online, shouldn’t delete his code editor quite yet. On Sunday, DHH posted about a test in which he had frontier agents implement and optimize his company’s Campfire group chat app in three languages: Elixir, Go, and Rust. He then compared the runtime performance of those versions with the original Ruby on Rails implementation.
这篇帖子中包含的数据似乎能证明Rust编程语言的效率之高,以及人工智能在代码编写方面的强大能力。然而,许多观察人士却得出了截然不同的结论:别轻信DHH给出的基准测试结果。截至发稿时,该帖子及其附带的图表浏览量已突破90万次。数据显示,在搜索消息、发布消息等五项测试任务中,用Rust重写的聊天应用均大幅领先于其他版本。
DHH’s post includes data that seemingly demonstrates the efficiency of the Rust programming language, and AI agent coding itself. But many observers came to another conclusion: Don't trust DHH’s benchmarks. As of press time, the post and accompanying chart garnered over 900,000 views. It showed the Rust rewrite of the chat app outperformed others by a wide margin on five tasks, including searching or posting a message.
DHH并未透露此次代码重写所使用的具体人工智能服务,不过他指出由于原代码本身主要由Ruby编写且体量较小,因此每次重写仅耗时数小时而已。不少观察人士,尤其是其他编程语言的拥护者,从帖子中迅速察觉到:DHH仅对Rust版本的代码进行了优化处理,其他语言版本则未做类似调整。高级编程语言的未来究竟如何?
DHH did not say which AI services he used for these rewrites, but noted that each rewrite took only a few hours, as the original code itself, largely written in Ruby, is relatively compact. Many observers, notably advocates of other languages, quickly surmised from the source material that DHH had optimized the Rust results but didn't do the same for the other languages he tested. Whither high-level languages?
如今,借助人工智能工具的协助,用Rust重写各类应用程序正成为一种流行趋势——微软的Copilot运行时、JavaScript包管理工具pnpm以及Bun JavaScript工具链都相继完成了Rust版本的重构。在DHH的测试中,Rust版本在全部五项测试任务中均轻松胜出,部分指标的领先幅度还相当显著。例如,在响应“聊天室页面”请求方面,Rust版本每秒可处理36,260次请求。
Rewriting applications in Rust, often with the help of AI agents, seems to be a popular undertaking these days, with Microsoft's Copilot runtime, the pnpm JavaScript installer, and the Bun JavaScript toolchain all getting the Rust treatment. In DHH’s test, the Rust implementation handily bested the others across all five workloads, sometimes by a wide margin. To serve a “room page,” for instance, Rust knocked out 36,260 requests per second.
相比之下,Ruby on Rails 仅能处理微弱的 241 个请求,而 Elixir 则实现了 722 个请求,甚至亚军 Golang 每秒也仅完成了 3,860 个请求。Rust 在执行其他任务时同样表现出惊人的速度,轻松超越了 DHH 所使用的其他语言。DHH 得出的结论显而易见:用 Rust 重写应用程序,或者更理想地让 AI 代理完成这项工作,很可能显著提升应用的性能。
In contrast, Ruby on Rails was only able to fulfill a paltry 241 requests, while Elixir delivered 722 requests, and even runner-up Golang only knocked out 3,860 requests a second. Rust executed the other tasks with similar alacrity, easily besting the other languages DHH used. The takeaway was obvious to DHH: Rewriting an application in Rust, or better yet having AI agents do the job, may very well result in major performance improvements for an app.
DHH 指出,为特定任务选择编程语言时需要考虑多种因素,执行速度并非唯一标准。Rust 的编译过程可能极其缓慢,而且对许多人来说,编写甚至阅读 Rust 代码都是一项艰巨的任务。DHH 本人于 2003 年在开发 Basecamp 时,就选择了当时相对冷门的 Ruby 编程语言来简化开发体验。他似乎并不介意 Ruby 在他自己的测试中排名最慢。
DHH suggested that many factors go into choosing a programming language for a particular job, and execution speed is not the sole criterion. Rust can be agonizingly slow to compile, and for many, writing or even reading Rust code is an arduous job. DHH himself began developing Rails in 2003 while building Basecamp in the then relatively obscure Ruby programming language to ease the developer experience. He doesn’t seem to mind that Ruby ranked the slowest in his own tests.
“当生产力提升和开发者幸福感带来的回报如此巨大时,我根本不在乎[性能]。”但 AI 代理可不会关心什么幸福感。“你必须把头埋在沙子里,才能看不到这样一个事实:当代理编写代码并验证输出时,我们需要适应一个全新的现实,”他写道。摊牌时刻 DHH 的非正式测试很快引发了质疑、批评甚至公开嘲讽,尤其是在 X 平台上。
“I didn't care about [performance] when the pay-off was huge in terms of productivity and developer joy.”But AI agents don’t give a hoot about joy. “You really have to bury your head in the sand not to see that when agents write the code and validate the output, we need to adjust to a new reality,” he wrote. Chips on the table DHH’s ad-hoc test was quickly met with skepticism, criticism and outright mockery, especially on X. (It’s as if DHH’s conservative views on immigration and his work to bring yet another Linux desktop into the world didn’t give him enough headaches).
(仿佛 DHH 对移民问题的保守观点以及他致力于推出又一款 Linux 桌面系统的努力,还不足以让他头疼一样。)“关于编程的未来,让我担忧的是,当你看到这些结果时,不会立刻意识到其中必然存在问题,或者你实际测量的内容本身就有问题,”谷歌知名工程师 Jaana Dogan 在 X 上回应 DHH 的测试时写道。Dogan 并未详细说明该测试的缺陷,但许多其他人,尤其是其他语言的倡导者,则非常乐意提供具体细节。
“What worries me about the future of programming is you see this and don’t immediately know there must be something wrong with the results or what you actually measured,” wrote prominent Google engineer Jaana Dogan in an X response to DHH’s tests. Dogan did not elaborate on the test’s shortcomings, but many others, especially advocates of other languages, were more than happy to provide details.
一位 Elixir 的支持者称 DHH 的实现“愚蠢至极”,而另外几个人则真的重写了 Elixir 代码,使其性能与 Rust 相当。经过这次重写后,尽管 Rust 版本还经过了第三方的进一步优化,Elixir 版本在某些任务上的表现仍然优于 Rust。DHH 对其他人竟然认为像 Elixir 或 Ruby 这样的高级语言能与更贴近硬件的 Rust 相提并论感到惊讶。
One Elixir advocate called DHH’s implementation “moronic,” while a couple of others actually rewrote the Elixir code to make its performance comparable to Rust’s. After that rewrite, the Elixir version of the app bested Rust’s performance on some tasks, despite further third-party Rust optimizations. DHH expressed surprise that others would assume a high-level language like Elixir or Ruby could even compete with a language like Rust, which runs closer to the metal.
但他也在 X 上指出:“如果前沿领域的开发者都找不到那些能让 Elixir 跑得更快的‘魔法开关’,那这其实也并不能给 Elixir 加分。”此外,有观察人士指出,Rust 版本的重写在代码完成之后获得了比其他 Go 和 Elixir 实现多得多的关注,而后者在最初的代理请求发布后似乎很快就被搁置了。“你们不是在比较语言本身,而是在比较每个移植版本获得了多少关注,”一位观察者在 X 上写道。
But he also noted on X that “It's not exactly extra points for Elixir if frontier agents can't find the magic ‘go fast’ switches.”Elsewhere, observers noted that the Rust rewrite got a lot more post-coding attention than the other implementations of Go and Elixir, both of which seemed to be quickly wrapped up after the initial agent requests. “You're not benchmarking languages, you're benchmarking how much attention each port got,” one observer wrote on X. Golang advocates were likewise unamused.
Go 的支持者同样对此感到不满。“这次基准测试并不公平。Rust 代码投入了更多时间,而其他语言则只是草草了事,”有人在 X 上写道。另一个人甚至制作了一张图表,显示 Rust 代码相较于其他语言的快速实现,在优化程度上要高出多少。这些反驳实际上并未否定 DHH 对使用代理进行编程的倡导。但显而易见,如果跳过对最终成果的人工审查,仍然会错失许多潜在的性能提升。®
“The benchmark was unfair. More time was put into the Rust code while the rest were one-shotted,” one wrote on X. Someone else even made their own chart showing how much more the Rust code was tuned compared to the quick passes on the other languages. None of these rebuttals actually negates DHH’s advocacy of using agents to code. But clearly, skipping a manual review of the resulting work will still leave a lot of potential gains on the table. ®