Skip to content

perf(linter/plugins): load methods of globals into local vars#14073

Merged
graphite-app[bot] merged 1 commit intomainfrom
09-24-perf_linter_plugins_load_methods_of_globals_into_local_vars
Sep 24, 2025
Merged

perf(linter/plugins): load methods of globals into local vars#14073
graphite-app[bot] merged 1 commit intomainfrom
09-24-perf_linter_plugins_load_methods_of_globals_into_local_vars

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Sep 24, 2025

Small perf optimization. All the code in apps/oxlint loads methods of global object e.g. Object, Array into local vars, for faster access. Continue that convention in these files.

@github-actions github-actions bot added A-linter Area - Linter A-cli Area - CLI C-performance Category - Solution not expected to change functional behavior, only performance labels Sep 24, 2025
Copy link
Member Author


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 hot fixes, skip the queue and merge this PR next

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.

@overlookmotel overlookmotel marked this pull request as ready for review September 24, 2025 09:42
Copilot AI review requested due to automatic review settings September 24, 2025 09:42
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 implements a performance optimization by caching methods from global objects (Object.keys, Object.create) into local variables for faster access. The changes align with the existing convention in the oxlint codebase of avoiding repeated property lookups on global objects.

  • Cache Object.keys as ObjectKeys local variable in two files
  • Cache Object.create as ObjectCreate local variable in one file
  • Replace direct method calls with cached local variables

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/visitor.ts Adds ObjectKeys local variable and uses it instead of Object.keys
apps/oxlint/src-js/plugins/load.ts Adds ObjectKeys local variable and uses it instead of Object.keys
apps/oxlint/src-js/index.ts Adds ObjectCreate to existing destructuring and uses it instead of Object.create

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@overlookmotel overlookmotel self-assigned this Sep 24, 2025
@overlookmotel overlookmotel added the 0-merge Merge with Graphite Merge Queue label Sep 24, 2025
Copy link
Member Author

overlookmotel commented Sep 24, 2025

Merge activity

Small perf optimization. All the code in `apps/oxlint` loads methods of global object e.g. `Object`, `Array` into local vars, for faster access. Continue that convention in these files.
@graphite-app graphite-app bot force-pushed the 09-24-perf_linter_plugins_load_methods_of_globals_into_local_vars branch from 178b567 to ce538c7 Compare September 24, 2025 09:45
@graphite-app graphite-app bot merged commit ce538c7 into main Sep 24, 2025
17 checks passed
@graphite-app graphite-app bot deleted the 09-24-perf_linter_plugins_load_methods_of_globals_into_local_vars branch September 24, 2025 09:50
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Sep 24, 2025
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 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