News for hackers. Stuff that matters.
Re:C++ Cheat Sheets by ncmncm on Sunday March 06, 2022 @09:39PM (#30583621)
Constexpr improves compilation speed by the degree that it displaces template metaprogramming. Template metaprogramming runs at Python speed, where constexpr runs orders of magnitude faster. Anywhere you have a choice between them, choose constexpr.

Substantial improvement in compilation speed might depend on use of JIT techniques, running generated code in the compiler to perform template evaluation. I.e., a template is not just a data structure, it is a compile-time function that, where used much, is compiled to optimized machine code, its run-time values being what we think of as types. Thus far, all these functions are run like an interpreter walking a syntax tree.

Precompiled headers, or module intermediate files, could have this code in them already optimized.

There are no comments on this comment yet.