Repository navigation
perf: Read Token::$id once per token in Lexer - #1171
Conversation
thats a interessting fact, I did not know about |
|
PHPUnit, when generating code-coverage, also does some PhpToken processing via https://github.com/theseer/tokenizer maybe you find similar opportunities there |
|
Is it actually true? PhpToken uses normal properties, it does not intercept the property handlers, so I don't see why it should be slow. |
|
@nikic so you say what is faster now is that we have a variable instead of a property-fetch? its unrelated to the fact of userland class vs. native class? |
|
Reading Subsequent |
Lexer::postprocessTokens()readsToken::$idtwice for every token.Tokenextends the internalPhpTokenclass, so each property read is comparatively expensive.This PR reads the token ID once and reuses it.
Tested faster: