perf(linter/plugins): load methods of globals into local vars#14073
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via 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. |
There was a problem hiding this comment.
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.keysasObjectKeyslocal variable in two files - Cache
Object.createasObjectCreatelocal 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.
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.
178b567 to
ce538c7
Compare

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