perf(estree/tokens): do not JSON-encode this identifiers#19813
Merged
graphite-app[bot] merged 1 commit intomainfrom Feb 27, 2026
Merged
Conversation
Member
Author
Merging this PR will not alter performance
Comparing Footnotes
|
This was referenced Feb 27, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR optimizes the serialization of this keyword tokens in TypeScript type queries and parameters by using the faster EstreeIdentToken serializer instead of the generic JSON-encoding path. This follows the same optimization pattern introduced in PR #19744 for regular identifier tokens.
Changes:
- Added
emit_this_identifiermethod that uses optimizedserialize_ident_tokenfor "this" keywords - Updated three call sites to use the new optimized method instead of
emit_token_at
Contributor
Merge activity
|
6d2668e to
b378f4a
Compare
efa2364 to
6260ddd
Compare
graphite-app bot
pushed a commit
that referenced
this pull request
Feb 27, 2026
…ns (#19814) After #19744, #19813, #19812, and #19796, all tokens which require special handling or can contain `value`s which are possibly not JSON-safe are handled separately. So everything remaining (keywords, punctuators etc) are JSON-safe and can be serialized via the optimized serializer introduced for identifiers in #19744. To reflect that `EstreeIdentToken` now handles a lot more than identifiers, rename it to `EstreeSafeToken`, and rename `EstreeToken` to `EstreeUnsafeToken`. Large positive perf impact. +24% on ESTree tokens benchmark.
Base automatically changed from
om/02-22-perf_estree_tokens_do_not_json-encode_jsx_identifiers
to
main
February 27, 2026 18:47
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Same as #19744, but for
thisidentifiers in TS types. Serialize them using the same optimizedEstreeIdentTokenserializer added in that PR.This isn't a hot path so makes little difference, but it completes the preconditions for the next PR #19814.