HN 精选

CppCon 2019: Chandler Carruth “There Are No Zero-cost Abstractions”

CppCon
7 人推荐 · 跨 7 个月 · 2020–2026
系统编程语言(C/C++、Rust、Go)软件性能与系统优化
CppCon 2019: Chandler Carruth “There Are No Zero-cost Abstractions”

中文导读

Chandler Carruth 在 CppCon 2019 演讲中直言 C++ 并不存在真正的“零成本抽象”。他结合 unique_ptr、ABI 约束及编译期开销等实操案例,证明任何抽象终归会在运行性能、编译耗时或认知心智上付出代价。

为什么 HN 推它

每当社区争论“零成本抽象”神话时,HN 网友必推此片,尤其常用来解释为何在某些 ABI 规范下 unique_ptr 并非全无开销。

「Chandler 的论点清晰透彻,而且对底层细节挖掘得足够深。」HN 网友原话:Chandler presents his point clearly and goes deep enough into the subject.
英文原摘要(HackerTube / Claude 整理)

Chandler Carruth argues in a CppCon 2019 talk that C++ has no truly zero-cost abstractions. Using examples like unique_ptr, ABI constraints and compile-time costs, he shows that abstractions cost runtime, compile time or human effort.

HN commenters cite it whenever zero-cost abstraction claims come up, especially for why unique_ptr is not free on some ABIs.

HN 上的提及

reference leni536 · 2020-02 · HN 原文
The talk on ABI-related overhead.
rec blux · 2020-02 · HN 原文
See for a nice expose on this.
reference aw1621107 · 2020-04 · HN 原文
Chandler Carruth talks about this at CppCon 2019
reference yesbutt11 · 2020-08 · HN 原文
I thought there were no zero cost abstractions in C++?
rec mehrdadn · 2020-09 · HN 原文
I just wanted to mention this talk about how "zero-cost abstraction" is an idealism, not necessarily a reality

相关视频