3 ms·
The bit vector does give a nice compression compared to the jump table. But I believe the main thing to do for speeding up string parsing is to consume more tha
by MobiusHorizons 2y ago
The bit vector does give a nice compression compared to the jump table. But I believe the main thing to do for speeding up string parsing is to consume more than one character at a time. I personally found the techniques in https://tia.mat.br/posts/2018/02/01/more_on_string_switch_in_c.html https://tia.mat.br/posts/2018/02/01/more_on_string_switch_in... very helpful to explain these issues.
EDIT: I especially like this statement from the conclusion:
> The good thing about the switch statement in C is that it is maybe the highest level statement in the language: the compiler can get really creative in how its code is generated. It's not uncommon for it to generate jump tables or even binary searches.