
13 Feb
2009
13 Feb
'09
2:45 a.m.
AMDG Michael Marcin wrote:
This reminds me of a discussion that came up when Steven Watanabe's Switch library was reviewed.
That's quite different. The comparison there is between a control construct (switch statement) and using some bit twiddling to look up data in an array. Naturally, the straight line code is faster. If you store an array of function pointers to call, the functionality being compared would be more equivalent, but, that, of course, introduces the possibility of branch mispredictions, forfeiting all the gains of using a perfect hash. The test case there is also somewhat unrealistic in that it takes a different branch each time. In Christ, Steven Watanabe