tunnelvisionlabs / antlr4ts

Optimized TypeScript target for ANTLR 4
Other
634 stars 109 forks source link

Replace Map<number, T> with sparse array in DFAState #468

Open BurtHarris opened 4 years ago

BurtHarris commented 4 years ago

Interesting little optimization, possible because JavaScript Arrays are sparse. Up to 17% improvement in lexer speed. See #467.

@sharwell your feedback would be interesting. I (still) don't understand PredictionContext.EMPTY_FULL_STATE_KEY, and how it is treated in this code.

Are the other opportunities listed in #467 at all likely to make significant differences?