Repository navigation
Commit c8b7218
committed
Inline the keyword lookup on the hot identifier path
The identifier/keyword branch handles the single largest share of tokens
(~17% identifiers plus all keywords, ~35-45% of the corpus). It called two
methods per token: get_current_token_bytes() to extract the token string and
determine_identifier_or_keyword_type() to classify it.
Inline that fast path into read_next_token(): extract the bytes and do the
strtoupper + TOKENS lookup directly, returning the identifier without any call
when it is not a keyword (the common case). The post-lookup keyword logic
(version gating, function-call lookahead, high-NOT precedence, synonyms) moves
to a new resolve_keyword_type() that is reached only for actual keywords;
determine_identifier_or_keyword_type() now delegates to it for its other caller.
Lex-only throughput on the MySQL server corpus: +5-6% under tracing JIT,
+3.4% without (best-of-seven, ABAB-confirmed). The keyword path's measured
ceiling was ~10% (JIT), most of which is the irreducible substr/strtoupper/
hash-lookup work that remains.1 parent 58cef92 commit c8b7218
1 file changed
Lines changed: 23 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2438 | 2438 | | |
2439 | 2439 | | |
2440 | 2440 | | |
2441 | | - | |
| 2441 | + | |
| 2442 | + | |
2442 | 2443 | | |
2443 | | - | |
2444 | | - | |
2445 | | - | |
2446 | | - | |
| 2444 | + | |
| 2445 | + | |
| 2446 | + | |
| 2447 | + | |
| 2448 | + | |
| 2449 | + | |
| 2450 | + | |
| 2451 | + | |
| 2452 | + | |
| 2453 | + | |
2447 | 2454 | | |
2448 | 2455 | | |
2449 | 2456 | | |
| |||
2996 | 3003 | | |
2997 | 3004 | | |
2998 | 3005 | | |
2999 | | - | |
3000 | | - | |
3001 | | - | |
3002 | | - | |
| 3006 | + | |
3003 | 3007 | | |
3004 | 3008 | | |
3005 | 3009 | | |
| 3010 | + | |
| 3011 | + | |
| 3012 | + | |
| 3013 | + | |
| 3014 | + | |
| 3015 | + | |
| 3016 | + | |
| 3017 | + | |
| 3018 | + | |
| 3019 | + | |
3006 | 3020 | | |
3007 | 3021 | | |
3008 | 3022 | | |
| |||
0 commit comments