Skip to content

perf(linter/plugins): share empty Uint32Array across multiple places#20509

Merged
graphite-app[bot] merged 1 commit intomainfrom
om/03-18-perf_linter_plugins_share_empty_uint32array_across_multiple_places
Mar 21, 2026
Merged

perf(linter/plugins): share empty Uint32Array across multiple places#20509
graphite-app[bot] merged 1 commit intomainfrom
om/03-18-perf_linter_plugins_share_empty_uint32array_across_multiple_places

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Mar 19, 2026

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

Copy link
Member Author

overlookmotel commented Mar 19, 2026


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent changes, fast-track this PR to the front of the merge queue

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_ARRAY constant in tokens.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.

@overlookmotel overlookmotel force-pushed the om/03-18-perf_linter_plugins_share_empty_uint32array_across_multiple_places branch from 3b2206a to 6f6dda2 Compare March 19, 2026 00:40
@graphite-app graphite-app bot added the 0-merge Merge with Graphite Merge Queue label Mar 20, 2026
@overlookmotel overlookmotel removed the 0-merge Merge with Graphite Merge Queue label Mar 20, 2026
@overlookmotel overlookmotel added the 0-merge Merge with Graphite Merge Queue label Mar 20, 2026 — with Graphite App
Copy link
Member Author

overlookmotel commented Mar 20, 2026

Merge activity

@overlookmotel overlookmotel force-pushed the om/03-18-perf_linter_plugins_faster_conversion_of_span_to_location_ branch from a229810 to ee2f73e Compare March 21, 2026 12:21
@overlookmotel overlookmotel force-pushed the om/03-18-perf_linter_plugins_share_empty_uint32array_across_multiple_places branch from 6f6dda2 to 7b5d718 Compare March 21, 2026 12:21
@overlookmotel overlookmotel force-pushed the om/03-18-perf_linter_plugins_faster_conversion_of_span_to_location_ branch from ee2f73e to bf0cd7d Compare March 21, 2026 12:33
@overlookmotel overlookmotel force-pushed the om/03-18-perf_linter_plugins_share_empty_uint32array_across_multiple_places branch from 7b5d718 to 4c2b69a Compare March 21, 2026 12:33
@graphite-app graphite-app bot force-pushed the om/03-18-perf_linter_plugins_faster_conversion_of_span_to_location_ branch from bf0cd7d to deb418b Compare March 21, 2026 12:54
@graphite-app graphite-app bot force-pushed the om/03-18-perf_linter_plugins_share_empty_uint32array_across_multiple_places branch from 4c2b69a to e233fae Compare March 21, 2026 12:55
#20509)

Tiny optimization. Various vars are initialized as an empty `Uint32Array`. Use a single empty array for all of them.
@graphite-app graphite-app bot force-pushed the om/03-18-perf_linter_plugins_faster_conversion_of_span_to_location_ branch from deb418b to 336f7f7 Compare March 21, 2026 13:03
@graphite-app graphite-app bot force-pushed the om/03-18-perf_linter_plugins_share_empty_uint32array_across_multiple_places branch from e233fae to 30891bd Compare March 21, 2026 13:03
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Mar 21, 2026
Base automatically changed from om/03-18-perf_linter_plugins_faster_conversion_of_span_to_location_ to main March 21, 2026 13:08
@graphite-app graphite-app bot merged commit 30891bd into main Mar 21, 2026
24 checks passed
@graphite-app graphite-app bot deleted the om/03-18-perf_linter_plugins_share_empty_uint32array_across_multiple_places branch March 21, 2026 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-cli Area - CLI A-linter Area - Linter A-linter-plugins Area - Linter JS plugins 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.

2 participants