Skip to content

Support running pub concurrently up to 1/2 the number of processors#5908

Merged
DanTup merged 2 commits intomasterfrom
concurrent-pub
Feb 17, 2026
Merged

Support running pub concurrently up to 1/2 the number of processors#5908
DanTup merged 2 commits intomasterfrom
concurrent-pub

Conversation

@DanTup
Copy link
Member

@DanTup DanTup commented Feb 17, 2026

With an option (dart.runPubConcurrently) to opt-out.

This only applies to the proper batches, and not to manually triggered pubs invocations (which will still queue).

Fixes #5907

With an option (`dart.runPubConcurrently`) to opt-out.

This only applies to the proper batches, and not to manually triggered pubs invocations (which will still queue).

Fixes #5907
@DanTup DanTup added this to the v3.130.0 milestone Feb 17, 2026
@DanTup DanTup added is enhancement An enhancement or improvement that should be listed in release notes but is not a bug fix. in commands Relates to commands (usually invoked from the command Palette) labels Feb 17, 2026
@DanTup DanTup requested a review from Copilot February 17, 2026 15:49
@DanTup
Copy link
Member Author

DanTup commented Feb 17, 2026

@codex review

/gemini review

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

The pull request introduces concurrent execution for pub commands, which is a significant performance improvement for multi-project workspaces. The implementation uses a worker-based concurrency limit and provides a unified progress reporting mechanism. I have identified a logic bug in the new resolvePackageTargetUri helper and a UX regression in the progress display for batch operations. Additionally, there is an inaccurate comment in sdk.ts regarding the timeout duration.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1a8da1c280

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link

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 adds support for running pub operations concurrently across multiple folders, up to half the number of available CPU cores. This significantly improves performance when working with large mono-repos containing many packages (like flutter-packages with 205 projects).

Changes:

  • Added concurrent execution support for batch pub/flutter operations with a configurable concurrency limit (defaulting to CPU count / 2)
  • Added a new configuration option dart.runPubConcurrently (defaults to true) to allow users to opt-out
  • Refactored batch operation progress reporting to show active packages and completion counts

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/test/dart/commands/pub_concurrency.test.ts New test file for concurrency utilities
src/shared/pub/utils.ts Core concurrency utilities and max concurrent process calculation
src/extension/config.ts New configuration option for concurrent pub execution
src/extension/commands/sdk.ts Removed old progress tracking code and updated timeout constant
src/extension/commands/packages.ts Refactored to use new batch operation handler
src/extension/commands/flutter.ts Refactored flutter clean to use new batch operation handler
src/extension/commands/batch_progress.ts New progress tracking for concurrent batch operations
package.json Configuration schema for the new setting

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

@codecov
Copy link

codecov bot commented Feb 17, 2026

Codecov Report

❌ Patch coverage is 69.89247% with 28 lines in your changes missing coverage. Please review.
✅ Project coverage is 67.67%. Comparing base (8f24b5c) to head (a7fc646).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
src/extension/commands/packages.ts 37.50% 9 Missing and 1 partial ⚠️
src/extension/commands/sdk.ts 41.17% 8 Missing and 2 partials ⚠️
src/shared/pub/utils.ts 76.92% 6 Missing ⚠️
src/extension/commands/batch_progress.ts 96.55% 0 Missing and 1 partial ⚠️
src/extension/commands/flutter.ts 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5908      +/-   ##
==========================================
+ Coverage   67.51%   67.67%   +0.16%     
==========================================
  Files         168      169       +1     
  Lines       12939    12976      +37     
  Branches     2563     2564       +1     
==========================================
+ Hits         8736     8782      +46     
+ Misses       3749     3741       -8     
+ Partials      454      453       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@DanTup DanTup requested a review from Copilot February 17, 2026 17:16
@DanTup
Copy link
Member Author

DanTup commented Feb 17, 2026

/gemini review

@DanTup
Copy link
Member Author

DanTup commented Feb 17, 2026

@codex review

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces concurrent execution for batch pub operations, controlled by a new setting dart.runPubConcurrently. The concurrency is limited to half the number of CPU cores. This is implemented with a new generic runWithConcurrencyLimit utility. The existing commands for batch operations (flutter clean, pub get, pub upgrade) are refactored to use this new concurrent mechanism, which cleans up the code. A new file batch_progress.ts is added to handle progress reporting for these batch operations. Tests for the new concurrency logic are also included.

The changes are well-structured and the new concurrency utility is robust. I have one suggestion to improve the stability of the progress message to reduce flickering.

Copy link

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

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


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

@chatgpt-codex-connector
Copy link

Codex Review: Didn't find any major issues. 🚀

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@DanTup DanTup merged commit d3e3938 into master Feb 17, 2026
27 checks passed
@DanTup DanTup deleted the concurrent-pub branch February 17, 2026 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in commands Relates to commands (usually invoked from the command Palette) is enhancement An enhancement or improvement that should be listed in release notes but is not a bug fix.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make pub get all run in parallel

2 participants