Table lookups - this is pretty definitive

Dmitry Olshansky dmitry.olsh at gmail.com
Wed Apr 2 01:58:33 PDT 2014


02-Apr-2014 12:27, Daniel N пишет:
> On Wednesday, 2 April 2014 at 03:47:58 UTC, Marco Leise wrote:
>> Do I see it right that it really comes down to one use of
>> isIdentifierStart(c) in one huge switch-case? Since "warp"
>> seems to be interested only in ASCII properties since it is
>> processing C code, could the switch-case be optimized into a
>> 256 entries large jump table?
>>
>> If a table lookup (char->bool) is faster than multiple
>> comparisons, why shouldn't this apply to char->address as well?
>
> I was thinking the same, sure would be nice if computed goto:s were
> standardized. (as suggested by Bearophile many times)
>

_Explicit_ tail call (aka switch-call) would have been cleaner and more 
modular. It covers all relevant cases of computed-goto such as 
threaded-code interpreters and also recursion-heavy functional code.

-- 
Dmitry Olshansky


More information about the Digitalmars-d mailing list