4 ms·
That's because there's no right or wrong answer about this, and people on here are not just a bunch of juniors who should automatically accept as an authority a
by jacknews 4y ago
That's because there's no right or wrong answer about this, and people on here are not just a bunch of juniors who should automatically accept as an authority anyone who blogs.
If switch/case actually does compare each and every item, as the article claims, then obviously a dispatch table is a solid choice to improve performance.
But that is just not likely the case in this example (and it does depend on a number of factors), and so it's then largely a matter of taste. This technique definitely has it's place, but this example is not the best, um, case, IMHO.