Skip to content

perf(linter/plugins): remove Arcs#15431

Merged
graphite-app[bot] merged 1 commit intomainfrom
11-07-perf_linter_plugins_remove_arc_s
Nov 7, 2025
Merged

perf(linter/plugins): remove Arcs#15431
graphite-app[bot] merged 1 commit intomainfrom
11-07-perf_linter_plugins_remove_arc_s

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Nov 7, 2025

Remove 2 levels of Arcs from ExternalLinter.

  1. Make wrapped callback functions Box<dyn Fn> instead of Arc<dyn Fn>.
  2. Avoid wrapping ThreadsafeFunctions in Arc. The closures take ownership of them anyway. In wrap_load_plugin, make the inner closure borrow the ThreadsafeFunction from the outer closure.

The first of these (and possibly the 2nd too) was prevented previously by #[derive(Clone)] on Linter. Linter doesn't appear to need to be cloned, so remove that derive.

@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 Nov 7, 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 November 7, 2025 13:50
Copilot AI review requested due to automatic review settings November 7, 2025 13:50
@overlookmotel
Copy link
Member Author

overlookmotel commented Nov 7, 2025

@camc314 Can I check it's OK to remove #[derive(Clone)] from Linter? Doesn't seem to break anything, and I'm unclear why you'd want to clone it anyway, but there may be something I'm missing...

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 refactors callback types from Arc<dyn Fn...> to Box<dyn Fn...> and removes unnecessary Clone derives from Linter and ExternalLinter structs.

  • Simplified callback wrapper functions by removing Arc cloning overhead
  • Updated type aliases for external linter callbacks to use Box instead of Arc
  • Removed Clone derive from structs that no longer need to be cloneable

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
crates/oxc_linter/src/lib.rs Removed Clone derive from Linter struct
crates/oxc_linter/src/external_linter.rs Changed callback type aliases from Arc to Box and removed Clone derive from ExternalLinter
apps/oxlint/src/js_plugins/external_linter.rs Updated callback wrapper functions to use Box instead of Arc, removing Arc cloning logic

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@camc314 camc314 added the 0-merge Merge with Graphite Merge Queue label Nov 7, 2025
Copy link
Contributor

camc314 commented Nov 7, 2025

Merge activity

@camc314
Copy link
Contributor

camc314 commented Nov 7, 2025

@camc314 Can I check it's OK to remove #[derive(Clone)] from Linter? Doesn't seem to break anything, and I'm unclear why you'd want to clone it anyway, but there may be something I'm missing...

don't think it's needed

Remove 2 levels of `Arc`s from `ExternalLinter`.

1. Make wrapped callback functions `Box<dyn Fn>` instead of `Arc<dyn Fn>`.
2. Avoid wrapping `ThreadsafeFunction`s in `Arc`. The closures take ownership of them anyway. In `wrap_load_plugin`, make the inner closure borrow the `ThreadsafeFunction` from the outer closure.

The first of these (and possibly the 2nd too) was prevented previously by `#[derive(Clone)]` on `Linter`. `Linter` doesn't appear to need to be cloned, so remove that derive.
@codspeed-hq
Copy link

codspeed-hq bot commented Nov 7, 2025

CodSpeed Performance Report

Merging #15431 will not alter performance

Comparing 11-07-perf_linter_plugins_remove_arc_s (ab6bafa) with main (e32bbf6)1

Summary

✅ 4 untouched
⏩ 33 skipped2

Footnotes

  1. No successful run was found on main (1416e8e) during the generation of this report, so e32bbf6 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

  2. 33 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@graphite-app graphite-app bot force-pushed the 11-07-perf_linter_plugins_remove_arc_s branch from ab6bafa to 3166233 Compare November 7, 2025 13:53
@graphite-app graphite-app bot merged commit 3166233 into main Nov 7, 2025
20 checks passed
@graphite-app graphite-app bot deleted the 11-07-perf_linter_plugins_remove_arc_s branch November 7, 2025 13:59
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Nov 7, 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.

3 participants