perf(linter/plugins): share empty Uint32Array across multiple places#20509
Merged
graphite-app[bot] merged 1 commit intomainfrom Mar 21, 2026
Conversation
This was referenced Mar 19, 2026
Member
Author
This was referenced Mar 19, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a small performance optimization in the JS-side oxlint plugin runtime by reusing a single empty Uint32Array instance instead of creating multiple identical empty typed arrays across modules.
Changes:
- Add a shared
EMPTY_UINT32_ARRAYconstant intokens.ts. - Replace several
new Uint32Array(0)initializations with the shared constant in tokens, comments, and merged tokens/comments buffering.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| apps/oxlint/src-js/plugins/tokens.ts | Defines and uses a shared EMPTY_UINT32_ARRAY for token-related typed-array initial state. |
| apps/oxlint/src-js/plugins/tokens_and_comments.ts | Reuses EMPTY_UINT32_ARRAY for the merged tokens/comments backing buffer’s empty initial state. |
| apps/oxlint/src-js/plugins/comments.ts | Reuses EMPTY_UINT32_ARRAY for comment index tracking and for zero-comment fast paths. |
3b2206a to
6f6dda2
Compare
Member
Author
Merge activity
|
a229810 to
ee2f73e
Compare
6f6dda2 to
7b5d718
Compare
ee2f73e to
bf0cd7d
Compare
7b5d718 to
4c2b69a
Compare
bf0cd7d to
deb418b
Compare
4c2b69a to
e233fae
Compare
#20509) Tiny optimization. Various vars are initialized as an empty `Uint32Array`. Use a single empty array for all of them.
deb418b to
336f7f7
Compare
e233fae to
30891bd
Compare
Base automatically changed from
om/03-18-perf_linter_plugins_faster_conversion_of_span_to_location_
to
main
March 21, 2026 13:08
This was referenced Mar 23, 2026
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.

Tiny optimization. Various vars are initialized as an empty
Uint32Array. Use a single empty array for all of them.