2 ms·
Overly broad statement. const for global or static variables do make code faster, as they are placed in the .rodata segment, which allows swapping them out for
by rurban 7y ago
Overly broad statement.
const for global or static variables do make code faster, as they are placed in the .rodata segment, which allows swapping them out for free. This can be a huge win.
He only talks about const args, where the compiler does not try yet to check for casts which violate the constness guarantees. (DFA, Escape Analysis). And thus misses all important optimizations. You cannot rely on that never being implemented in the future. With LTO they already do I think.