Skip to content

perf(estree/tokens): use strings from AST for identifier tokens#19744

Draft
overlookmotel wants to merge 1 commit intomainfrom
om/02-26-perf_estree_tokens_use_strings_from_ast_for_identifier_tokens
Draft

perf(estree/tokens): use strings from AST for identifier tokens#19744
overlookmotel wants to merge 1 commit intomainfrom
om/02-26-perf_estree_tokens_use_strings_from_ast_for_identifier_tokens

Conversation

@overlookmotel
Copy link
Member

No description provided.

@github-actions github-actions bot added the C-performance Category - Solution not expected to change functional behavior, only performance label Feb 26, 2026
This was referenced Feb 26, 2026
@overlookmotel overlookmotel force-pushed the om/02-26-perf_estree_tokens_use_strings_from_ast_for_identifier_tokens branch from aec3c03 to 7d3b668 Compare February 26, 2026 14:05
@overlookmotel overlookmotel force-pushed the om/02-26-perf_estree_tokens_use_strings_from_ast_for_identifier_tokens branch from 7d3b668 to e162e09 Compare February 26, 2026 16:09
@overlookmotel overlookmotel changed the base branch from graphite-base/19744 to om/02-26-perf_estree_use_codebuffer_print_strs_array_to_reduce_bounds_checks February 26, 2026 16:10
@overlookmotel overlookmotel force-pushed the om/02-26-perf_estree_tokens_use_strings_from_ast_for_identifier_tokens branch from e162e09 to af6b068 Compare February 26, 2026 16:12
@overlookmotel overlookmotel changed the base branch from om/02-26-perf_estree_use_codebuffer_print_strs_array_to_reduce_bounds_checks to graphite-base/19744 February 26, 2026 19:18
@overlookmotel overlookmotel force-pushed the om/02-26-perf_estree_tokens_use_strings_from_ast_for_identifier_tokens branch 2 times, most recently from a25d804 to b7e17fa Compare February 26, 2026 19:20
@overlookmotel overlookmotel changed the base branch from graphite-base/19744 to om/02-26-refactor_estree_tokens_add_tokentype_type February 26, 2026 19:20
@overlookmotel overlookmotel force-pushed the om/02-26-perf_estree_tokens_use_strings_from_ast_for_identifier_tokens branch 2 times, most recently from a6a2335 to 7374d6c Compare February 26, 2026 21:39
@overlookmotel overlookmotel force-pushed the om/02-26-perf_estree_tokens_use_strings_from_ast_for_identifier_tokens branch from 7374d6c to a5484d1 Compare February 26, 2026 23:42
@overlookmotel overlookmotel force-pushed the om/02-26-refactor_estree_tokens_add_tokentype_type branch from 576c090 to 573af00 Compare February 26, 2026 23:42
graphite-app bot pushed a commit that referenced this pull request Feb 26, 2026
In `ESTree` trait, expose the buffer and formatter to callers. Usually callers use the standard APIs for serialization (`serializer.serialize_struct()` etc), exposing the underlying primitives allows callers to manually construct the JSON themselves where it's useful to do that for perf.

This is used in #19744 to net a +9% perf gain in ESTree token serialization.
@graphite-app graphite-app bot force-pushed the om/02-26-refactor_estree_tokens_add_tokentype_type branch from 573af00 to 14f62f7 Compare February 27, 2026 00:01
@graphite-app graphite-app bot force-pushed the om/02-26-perf_estree_tokens_use_strings_from_ast_for_identifier_tokens branch from a5484d1 to 94e842a Compare February 27, 2026 00:02
graphite-app bot pushed a commit that referenced this pull request Feb 27, 2026
Add `IS_COMPACT` const to `Formatter` and `Serializer` traits. In conjunction with #19773, callers can manually construct JSON themselves in the correct format for the serializer (compact or pretty-printed).

This is used in #19744 to net a +9% perf gain in ESTree token serialization.
@graphite-app graphite-app bot changed the base branch from om/02-26-refactor_estree_tokens_add_tokentype_type to graphite-base/19744 February 27, 2026 00:11
graphite-app bot pushed a commit that referenced this pull request Feb 27, 2026
Refactor. Add a `TokenType` type which represents the type of a token. It's purely a wrapper around a `&'static str`, except that it enforces a maximum length on the string.

This invariant is used in #19744 to avoid overflow checks when calling `CodeBuffer::print_strs_array`.
@graphite-app graphite-app bot force-pushed the om/02-26-perf_estree_tokens_use_strings_from_ast_for_identifier_tokens branch from 94e842a to e95d9b3 Compare February 27, 2026 00:19
@graphite-app graphite-app bot force-pushed the graphite-base/19744 branch from 14f62f7 to 9ced342 Compare February 27, 2026 00:19
@graphite-app graphite-app bot changed the base branch from graphite-base/19744 to main February 27, 2026 00:19
@graphite-app graphite-app bot force-pushed the om/02-26-perf_estree_tokens_use_strings_from_ast_for_identifier_tokens branch from e95d9b3 to 569d6a0 Compare February 27, 2026 00:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-performance Category - Solution not expected to change functional behavior, only performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant