Lexicon Entry
Constant Folding
A compiler optimization that evaluates constant expressions at compile time instead of generating code to compute them at runtime. For example, 3 + 4 * 2 is replaced by 11 in the compiled output.
Related Knowledge & Cross-References
Guide
The Ultimate Guide to Compiler Optimization Passes: Boosting Performance with -O2
You have written your code, but how does the compiler make it run three times faster when you enable optimizations? We demystify compiler optimization passes and see exactly what happens under the hood.