DHH给屏保手搓x86汇编结果都是喷他的?

admin 2026-10-06 05:29:52 网络安全文章 来源:ZONE.CI 全球网 0 阅读模式

文章总结: DHH将ttfx终端特效工具渲染引擎手写为x86-64汇编,性能较Python提升1000倍、较旧Rust提升32倍,但评论区争议认为这是为感知不到的收益牺牲可移植性与可维护性,属无意义优化。DHH回应称追求卓越无需理由且拥有无限token可随意优化。事件反映AI时代汇编优化价值与取舍之争。 综合评分: 70 文章分类: 实战经验,其他


DHH 给屏保手搓 x86 汇编结果都是喷他的?

原创

crossoverJie crossoverJie

crossoverJie

2026年9月30日 15:59 重庆

在小说阅读器读本章

去阅读

在公众号小说中沉浸阅读

背景

前两天 DHH(David Heinemeier Hansson,Ruby on Rails, 之父、Omarchy 作者、在 X 上发了条推,官宣了一件事:

The asm-accelerated version of ttfx has been released as 0.4. Will ship in next Omarchy. This print effect now runs more than 1,000x faster than the original Python and 32x faster than the old Rust! (But we’ll soon speed up the Rust fallback too.)

简单来说他把 ttfx 这个终端文字特效工具的渲染引擎,手搓成了 x86-64 汇编,Rust 版作为 fallback。然后发推炫耀性能——比原版 Python 快 1000 倍,比旧 Rust 快 32 倍。

先交代下 ttfx 是啥:它是 TerminalTextEffects(TTE)的一个 Rust 移植版,用途是往终端里灌各种文字动画(类似于黑客帝国的数字雨),一共 37 种特效。原本的 TTE 是 Python 包,ttfx 把它重写成单个零依赖的静态二进制,启动 < 1ms,渲染速度号称快几百倍。本质上是个塞进 shell pipline 里的小玩具。

DHH 把渲染引擎手写成 x86-64 汇编,不支持 asm 的平台回退到 Rust。

这事看起来真的很牛逼,我就点进 PR 里看看,结果发现评论区里“喷” DHH 的不少。

把评论区的高赞/高踩发言看了一遍,核心观点就是为感知不到的收益,牺牲可移植性和可维护性,值不值。

011. 反对派:这不是优化,是带着锤子找钉子

最高赞的批评来自 nonetrix,拿下了 81 个赞、2 个踩,几乎是共识性支持:

No offence, but why make this less portable for likely zero perceivable speedup? … The only realistic difference between this and the old version is that it doesn’t work on ARM or whatever other architecture now … This is 101 definition of misplaced priorities in my opinion.

翻译一下他的意思:屏保这玩意儿,谁会在意它快不快?你在过去 30 年造的硬件上都大概率感知不到差别,结果唯一的区别就是 ARM 上跑不了了。说白了就是一个没意义的优化。

更狠的技术反驳来自 koolkdev,拿下 20 赞、1 踩:

Did you look on this PR? Most of it is doing the compiler job and just rewriting regular assembly functions. Architecture-specific optimizations is exposing hardware specific primitives or writing specific functions that use them in assembly, while making most of the code shared between the architectures. Otherwise it is just a recipe for maintenance hell without any real gain.

这句要划重点:你这 PR 大部分活儿是在重复编译器本来就干的事——把普通函数手搓成汇编。真正的架构优化,是暴露硬件原语、其余代码在架构间共享,而不是整段重写。否则就是「维护地狱 + 零实际收益」。

022. DHH 的回应

DHH 亲自下场回怼,结果被 81 踩、9 赞——和上面那条批评的票数几乎镜像对称:

“The pursuit of excellence requires no justification”. And if you’d look at the code, you’d see that we fall back to the slower Rust implementation when asm acceleration is not possible.

Also, you’re still stuck in fixed-pie thinking if you think this is happening at the expense of anything else. I have unlimited tokens. We can fix everything, we can do anything.

我 token 无限啊,随便搞。

看完之后给我的感觉就是有 token 就是硬气啊,可以把以前的一些纯体力活完全解放出来,但是也正如评论区里提到的,把这些token 拿去优化更有意义的事情不好吗?

马上放假了,大家就当看个乐子。


免责声明:

本文所载程序、技术方法仅面向合法合规的安全研究与教学场景,旨在提升网络安全防护能力,具有明确的技术研究属性。

任何单位或个人未经授权,将本文内容用于攻击、破坏等非法用途的,由此引发的全部法律责任、民事赔偿及连带责任,均由行为人独立承担,本站不承担任何连带责任。

本站内容均为技术交流与知识分享目的发布,若存在版权侵权或其他异议,请通过邮件联系处理,具体联系方式可点击页面上方的联系我。

本文转载自:crossoverJie crossoverJie crossoverJie《DHH 给屏保手搓 x86 汇编结果都是喷他的?》

评论:0   参与:  0