Switch implementation

retard re at tard.com.invalid
Tue Sep 28 19:44:31 PDT 2010


Tue, 28 Sep 2010 22:00:06 -0400, bearophile wrote:

> Robert Jacques:
>> Well there are 28 labeled cases and ~16kb of jump table address space.
>> (32kb on 64-bit platforms)
> 
> 32 kb are enough to fill the code part of the L1 cache on most CPUs.

28 cases and 32 kB of space seems like a waste. I'd use some sort of 
hashing before the jump to eliminate unnecessary blank slots. However, 
even if this kind of solution was cache friendly, I have no idea how this 
would affect the operation of modern branch predictors.


More information about the Digitalmars-d mailing list