[virtmach] switch vs dispatch table (was Your VM)
Thaddaeus Frogley
virtmach@iecc.com
Tue, 29 May 2001 10:12:41 +0100
> Many compilers will generate an indirect jump through a
> table of pointers for a dense switch. Generally, the
> compiler can generate better code for this internally
> than can be written in source code, so the switch version
> is likely to be faster.
Most compilers will generate a range check before the jump, where as a hand
coded jump table can assume that the data is in range. Of course, its very
hard to say, as we haven't even mentioned what language this VM might be
implemented in...
Thad