You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Append end-of-input sentinel token to drop range checks
Add a sentinel WP_Parser_Token with id EMPTY_RULE_ID (0) to the end of
the token array. Real MySQL tokens never have id 0 (WHITESPACE, the only
token with id 0, is stripped by the lexer before tokens reach the
parser), so the sentinel cannot match any real terminal.
This lets the hot path drop the 'position < token_count' range check
everywhere it reads the current token id: the selector lookup at method
entry, the inline terminal match inside the branch loop, and the
post-branch INTO negative lookahead for selectStatement. Any read past
the last real token falls naturally into the nullable-fallback or
branch-miss handling.
Also drop a few dead locals ($token_count, $fragment_ids) that no
longer appear in the hot path after the change.
End-to-end parser benchmark:
Before: ~28,700 QPS (avg) After: ~29,800 QPS (+4%).
0 commit comments