Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Aug 14, 2025

Move creation of AllocatorPool into just one place. Previously it was created in various places and passed in to LintService::new which passed it to Runtime::new. Just create it in Runtime::new instead.

This does have one substantive effect. Language server was creating AllocatorPool with AllocatorPool::default (0 slots for Allocators) whereas now it's created with rayon::current_num_threads() slots.

This doesn't make much difference at present, because the pool creates allocators on demand. But it's going to become important when running JS plugins multi-threaded. At that point it'll be essential that the AllocatorPool is created with an accurate thread count, and undefined behavior may result if it isn't.

@github-actions github-actions bot added A-linter Area - Linter A-cli Area - CLI A-editor Area - Editor and Language Server C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior labels Aug 14, 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.

Copy link

codspeed-hq bot commented Aug 14, 2025

CodSpeed Instrumentation Performance Report

Merging #13106 will not alter performance

Comparing 08-15-refactor_linter_create_allocatorpool_in_runtime_new_ (6c5b8be) with main (5dfb40e)1

Summary

✅ 34 untouched benchmarks

Footnotes

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

@overlookmotel overlookmotel marked this pull request as ready for review August 14, 2025 23:24
@Copilot Copilot AI review requested due to automatic review settings August 14, 2025 23:24
Copy link
Contributor

@Copilot 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 the creation of AllocatorPool by moving it into Runtime::new instead of creating it in multiple places and passing it to LintService::new. This centralizes allocator pool creation and ensures consistent initialization across all usage sites.

Key Changes:

  • Removed AllocatorPool parameter from LintService::new and Runtime::new constructors
  • Moved AllocatorPool creation into Runtime::new with proper thread count initialization
  • Updated all call sites to use the simplified constructor signatures

Reviewed Changes

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

Show a summary per file
File Description
crates/oxc_linter/src/tester.rs Removes AllocatorPool import and parameter from LintService::new call
crates/oxc_linter/src/service/runtime.rs Creates AllocatorPool internally with rayon::current_num_threads()
crates/oxc_linter/src/service/mod.rs Removes AllocatorPool parameter from LintService::new constructor
crates/oxc_language_server/src/linter/isolated_lint_handler.rs Updates LintService::new call to use simplified signature
apps/oxlint/src/lint.rs Removes AllocatorPool creation and simplifies LintService::new call

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

@overlookmotel overlookmotel removed the request for review from Sysix August 14, 2025 23:25
@overlookmotel
Copy link
Member Author

overlookmotel commented Aug 14, 2025

@camc314 Is there any reason why this is a bad idea? I can't see one, but I'm not sure if there's a reason it was designed the way it is.

@overlookmotel overlookmotel force-pushed the 08-15-refactor_linter_create_allocatorpool_in_runtime_new_ branch 2 times, most recently from 48772f3 to 06c1f67 Compare August 15, 2025 14:59
@camc314 camc314 added the 0-merge Merge with Graphite Merge Queue label Aug 15, 2025
Copy link
Contributor

camc314 commented Aug 15, 2025

Merge activity

Move creation of `AllocatorPool` into just one place. Previously it was created in various places and passed in to `LintService::new` which passed it to `Runtime::new`. Just create it in `Runtime::new` instead.

This does have one substantive effect. Language server was creating `AllocatorPool` with `AllocatorPool::default` (0 slots for `Allocator`s) whereas now it's created with `rayon::current_num_threads()` slots.

This doesn't make much difference at present, because the pool creates allocators on demand. But it's going to become important when running JS plugins multi-threaded. At that point it'll be essential that the `AllocatorPool` is created with an accurate thread count, and undefined behavior may result if it isn't.
@graphite-app graphite-app bot force-pushed the 08-15-refactor_linter_create_allocatorpool_in_runtime_new_ branch from 06c1f67 to 6c5b8be Compare August 15, 2025 15:05
@graphite-app graphite-app bot merged commit 6c5b8be into main Aug 15, 2025
27 checks passed
@graphite-app graphite-app bot deleted the 08-15-refactor_linter_create_allocatorpool_in_runtime_new_ branch August 15, 2025 15:11
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Aug 15, 2025
@overlookmotel
Copy link
Member Author

Thanks for reviewing!

graphite-app bot pushed a commit that referenced this pull request Aug 15, 2025
Since #13106, `Default` is not used, and it shouldn't be. Remove it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-cli Area - CLI A-editor Area - Editor and Language Server A-linter Area - Linter C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants