V2EX  ›  英汉词典

Constant Folding

释义 Definition

(编译器/优化)常量折叠:在编译或优化阶段,把只由常量组成的表达式提前计算并替换为结果常量,以减少运行时开销、简化代码。也常见于解释器、JIT、静态分析与构建工具中。

发音 Pronunciation

/ˈkɑːnstənt ˈfoʊldɪŋ/(AmE), /ˈkɒnstənt ˈfəʊldɪŋ/(BrE)

例句 Examples

The compiler performs constant folding, so 2 + 3 becomes 5 before the program runs.
编译器会进行常量折叠,所以 2 + 3 在程序运行前就会变成 5

With constant folding and other optimizations enabled, the generated code can be smaller and faster, especially in tight loops.
启用常量折叠等优化后,生成的代码可能更小、更快,尤其是在频繁执行的循环中。

词源 Etymology

constant 源自拉丁语 constans(“坚定的、固定的”),在计算机语境中指“值固定不变的常量”;folding 来自动词 fold(“折叠、合并”),引申为把多个步骤“合并/压缩”为一个结果。合起来就是“把常量表达式折叠成一个常量结果”的优化术语。

相关词 Related Words

文学与经典作品 Notable Works

  • Compilers: Principles, Techniques, and Tools(Aho, Lam, Sethi, Ullman,“龙书”)——讨论编译器优化时常提到常量折叠/常量传播等变换。
  • Engineering a Compiler(Cooper & Torczon)——在优化章节中介绍包括常量折叠在内的中间代码优化方法。
  • Modern Compiler Implementation(Andrew W. Appel)——以实现视角讲解常量折叠等优化在 IR/AST 上的应用。
关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   803 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 12ms · UTC 19:42 · PVG 03:42 · LAX 11:42 · JFK 14:42
♥ Do have faith in what you're doing.