V2EX  ›  英汉词典

Constant-Folding

释义 Definition

常量折叠:一种编译器(或解释器/优化器)优化技术,在编译期(或优化阶段)把只由常量组成的表达式直接计算成结果,从而减少运行时计算、提升性能并简化代码。此术语在讨论编译器优化、静态分析与中间表示(IR)优化时很常见。

发音 Pronunciation (IPA)

/ˈkɒnstənt ˈfoʊldɪŋ/

例句 Examples

The compiler performs constant-folding to replace 2 + 3 with 5.
编译器会进行常量折叠,把 2 + 3 直接替换成 5。

After constant-folding and dead-code elimination, the generated code became smaller and faster.
经过常量折叠和死代码消除后,生成的代码更小、更快。

词源 Etymology

constant(常量)+ folding(折叠)。这里的“folding”并非“折纸”的意思,而是比喻把一个表达式“折叠/收起”为更简单的形式:把可确定的常量计算提前完成,让表达式在优化后变得更“紧凑”。

相关词 Related Words

文学与著作中的用例 Literary / Notable Works

  • Compilers: Principles, Techniques, and Tools(Aho, Lam, Sethi, Ullman,“龙书”):在介绍常见编译器优化时常提到常量折叠。
  • Engineering a Compiler(Cooper & Torczon):以优化流水线为背景讨论包括常量折叠在内的局部与全局优化。
  • LLVM 文档与相关著作(如 LLVM Cookbook):在 IR 优化(如 InstCombine 等)语境中频繁出现 “constant folding/ConstantFold”。
关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   3623 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 16ms · UTC 09:49 · PVG 17:49 · LAX 01:49 · JFK 04:49
♥ Do have faith in what you're doing.