
11 Nov
2019
11 Nov
'19
2:10 p.m.
Phil Endecott wrote:
If the compiler turns a sparse switch statement into an if-else-if chain, you might as well have an if-else-if chain in the first place (in terms of performance).
Compilers also turn an if-else chain into a switch: https://godbolt.org/z/7fgSXH In fact, I think that LLVM first turns the switch into an if-else chain, and then back into a switch in a later pass.