fix(runner): limit concurrency per task branch in addition to per leaf callbacks#10179
Conversation
✅ Deploy Preview for vitest-dev ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
@hi-ogawa Awesome! How can i test this pre release? |
@vitest/browser
@vitest/browser-playwright
@vitest/browser-preview
@vitest/browser-webdriverio
@vitest/coverage-istanbul
@vitest/coverage-v8
@vitest/expect
@vitest/mocker
@vitest/pretty-format
@vitest/runner
@vitest/snapshot
@vitest/spy
@vitest/ui
@vitest/utils
vitest
@vitest/web-worker
commit: |
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep it up! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
@dbousamra Please test it out the package in #10179 (comment). |
…-in-addition-to-leaf
|
Hi all. |
|
@dbousamra The fix is included in v5 beta for now https://github.com/vitest-dev/vitest/releases/tag/v5.0.0-beta.2 We can backport to v4 depending on user request (mainly you 😃) |
All depends on when we can expect a 5.0.0 proper release. Is it day, weeks, months away? Is 5.0.0 beta suitable for use now? |
|
Stable 5 would be a month away. It's not necessary "unstable" but it's just the phase where we pile up breaking changes as beta progress. I'll consider backporting this one liner patch to v4 soon. |
|
Hi @hi-ogawa I've tried upgrading our project from v3 to v4.1.7. Definitely better, however still a huge performance difference between v3 and v4. Here's an AI summary of my attempts at different configs: How do I go about investigating this further? Is this just an expected performance decrease, or should I chase this further? |
|
@dbousamra I cannot tell anything actionable from those numbers. Probably worth experiments would be to try patching this part of concurrency (like hard-code huge number here), then keep limiter at suite branch only (the one introduced in this PR). If that improves both stability and perf, then the bottleneck could be the leaf level acquire logic. That might narrow down minimally reproducing something actionable. vitest/packages/runner/src/run.ts Lines 1009 to 1010 in 4fee2e3 |
|
@hi-ogawa thanks. Will try. Are you able to tell me what the default concurrency is on v4? And that would mean the hooks are running with the tests yeah? I.e. concurrency of 4, would be 4 tests AND hook running at same time, never more? |
Description
concurrent#10069In #9653, we've changed concurrency limit from per-
runTestlevel to per-indivisual user callbacks. While it sounds clean in principle, it lostrunTestlevel serialization between siblings.For example, with the following tests and
maxConcurrent = 1:before #9653:
and current main after #9653:
(Notably this still guarantees each callback level in-out concurrency limit but not
beforeEach -> test -> afterEachlifecycle level in-out)This PR brings back siblings serialization guarantee by introducing independent concurrency limit at each task branch. This now also guarantees sibling suite hooks concurrency guarantee which has never existed even before #9653.
TODO
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
pnpm-lock.yamlunless you introduce a new test example.Tests
pnpm test:ci.Documentation
pnpm run docscommand.Changesets
feat:,fix:,perf:,docs:, orchore:.