Skip to content

perf(linter/plugins): reuse descriptor objects for Object.defineProperty calls#20505

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

perf(linter/plugins): reuse descriptor objects for Object.defineProperty calls#20505
graphite-app[bot] merged 1 commit intomainfrom
om/03-18-perf_linter_plugins_reuse_descriptor_objects_for_object.defineproperty_calls

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Mar 18, 2026

Small optimization. Don't create temporary objects repeatedly just to pass props to Object.defineProperty. Re-use a single object and reuse it instead.

Copy link
Member Author

overlookmotel commented Mar 18, 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.

@overlookmotel overlookmotel marked this pull request as ready for review March 18, 2026 21:56
@overlookmotel overlookmotel requested a review from camc314 as a code owner March 18, 2026 21:56
Copilot AI review requested due to automatic review settings March 18, 2026 21:56
@overlookmotel overlookmotel self-assigned this Mar 18, 2026
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

Optimizes hot-path property definition in the JS linter plugins by reusing PropertyDescriptor objects instead of allocating new descriptor objects for repeated Object.defineProperty calls.

Changes:

  • Reuse a module-level LOC_DESCRIPTOR when caching node.loc in getNodeLoc.
  • Reuse a module-level OPTIONS_DESCRIPTOR when updating context.options per rule/file.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
apps/oxlint/src-js/plugins/location.ts Reuses a single PropertyDescriptor for defining cached loc values on AST nodes.
apps/oxlint/src-js/plugins/lint.ts Reuses a single PropertyDescriptor for updating options on rule context objects.

@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
@overlookmotel overlookmotel force-pushed the om/03-18-perf_linter_plugins_reuse_descriptor_objects_for_object.defineproperty_calls branch from 33b0950 to 982be40 Compare March 21, 2026 12:21
@overlookmotel overlookmotel force-pushed the om/03-18-perf_linter_plugins_recycle_location_objects branch from e627943 to 48e7129 Compare March 21, 2026 12:21
@overlookmotel overlookmotel force-pushed the om/03-18-perf_linter_plugins_reuse_descriptor_objects_for_object.defineproperty_calls branch from 982be40 to c774a9d Compare March 21, 2026 12:32
@overlookmotel overlookmotel force-pushed the om/03-18-perf_linter_plugins_recycle_location_objects branch from 48e7129 to 24da144 Compare March 21, 2026 12:32
@graphite-app graphite-app bot changed the base branch from om/03-18-perf_linter_plugins_recycle_location_objects to graphite-base/20505 March 21, 2026 12:49
@graphite-app graphite-app bot force-pushed the graphite-base/20505 branch from 24da144 to 5984a66 Compare March 21, 2026 12:53
@graphite-app graphite-app bot force-pushed the om/03-18-perf_linter_plugins_reuse_descriptor_objects_for_object.defineproperty_calls branch from c774a9d to 44e3182 Compare March 21, 2026 12:53
@graphite-app graphite-app bot changed the base branch from graphite-base/20505 to main March 21, 2026 12:53
@graphite-app graphite-app bot force-pushed the om/03-18-perf_linter_plugins_reuse_descriptor_objects_for_object.defineproperty_calls branch from 44e3182 to cf6e31d Compare March 21, 2026 12:53
@graphite-app
Copy link
Contributor

graphite-app bot commented Mar 21, 2026

Merge activity

…erty` calls (#20505)

Small optimization. Don't create temporary objects repeatedly just to pass props to `Object.defineProperty`. Re-use a single object and reuse it instead.
@graphite-app graphite-app bot force-pushed the om/03-18-perf_linter_plugins_reuse_descriptor_objects_for_object.defineproperty_calls branch from cf6e31d to a187333 Compare March 21, 2026 12:57
@graphite-app graphite-app bot merged commit a187333 into main Mar 21, 2026
23 checks passed
@graphite-app graphite-app bot deleted the om/03-18-perf_linter_plugins_reuse_descriptor_objects_for_object.defineproperty_calls branch March 21, 2026 13:00
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Mar 21, 2026
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