chevrotain icon indicating copy to clipboard operation
chevrotain copied to clipboard

Removing IToken.tokenTypeIdx in favor of IToken.tokenType.tokenTypeIdx

Open HoldYourWaffle opened this issue 4 years ago • 2 comments

As discussed on gitter, creating an issue for it so I don't forget.

Are there performance reasons for tokenTypeIdx being a separate property instead of using tokenType.tokenTypeIdx?

the *Idx property was there initially, the tokenType was added for debug reasons. this creates a bit of duplication... It may be slightly faster to access the Idx directly instead of itok.tokenType.tokenTypeIdx. It may be worth investigating the removal of tokenTypeIdx in favor of only tokenType and measure the performance difference. There is a comparative benchmark in https://github.com/SAP/chevrotain/tree/master/packages/chevrotain/benchmark_web to test performance changes between different versions of Chevrotain. if the regression is small (1-3%) we can evaluate this model simplification.

HoldYourWaffle avatar Aug 31 '19 19:08 HoldYourWaffle

@bd82 Is it possible for you to assign me to this issue or do I need to be a member of the repository for that?

HoldYourWaffle avatar Aug 31 '19 19:08 HoldYourWaffle

Is it possible for you to assign me to this issue or do I need to be a member of the repository for that?

bd82 avatar Aug 31 '19 21:08 bd82