VItest 4.1.6 is slow when running many projects #10572
Unanswered
n0th1ng-else
asked this question in
Q&A
Replies: 1 comment 3 replies
-
|
It's natural expectation that there's some overhead for splitting tests into multiple projects. For example, projects allow isolating vite's transform pipeline and thus there might be less benefit for transform cache. To diagnose better, we would need concrete context on workspace setup and test configuration. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Describe the bug
Hello, dear team. I am curious to clarify one thing. First, the intro:
I am in the process of migrating our main application from Jest to Vitest. The stats to think of: ~7000 test files in ~830 yarn workspaces.
While I was doing my pre-migration research, I took the biggest workspace and tried to migrate it, then compared the numbers.
Vitest performed slightly better compared to our current Jest + swc parser setup.
Now we are doing the actual migration. So far, we have migrated ~2400 test files in ~400 workspaces.
At this moment, I realized that Vitest is so slow that I need to stop now and investigate it.
These are the stats I see on CI (we run 3 shards with tests now):
In total, it gives ~8 tests per second
Now this is the problem. I think I tried almost everything configuration-wide (appreciate your input if I missed something).
What is showing the actual difference now is merging the projects.
in our setup, we create a single vitest config file, and we define every workspace as a separate project entity. So we have the config with 400 projects right now. Most of the packages have the same local config, so I can just create an aggregated project in the config and include like 90% of the packages into a single aggregated project (ie instead of 400 projects, I ran 41 projects).
I just done an experiment with this and these are the numbers:
In total, it gives ~15,4 tsts per second
So the difference in almost 2x
I am curious to hear from you - if it is an intended behavior? Anything I could do better in our situation?
Thank you!
Reproduction
n/a for now, private repository
System Info
System: OS: macOS 26.4.1 CPU: (12) arm64 Apple M2 Pro Memory: 185.94 MB / 32.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 24.12.0 - /Users/sen/.nvm/versions/node/v24.12.0/bin/node Yarn: 4.10.1 - /opt/homebrew/bin/yarn npm: 11.6.2 - /Users/sen/.nvm/versions/node/v24.12.0/bin/npm pnpm: 10.33.0 - /Users/sen/Library/pnpm/pnpm bun: 1.3.5 - /Users/sen/.bun/bin/bun Deno: 2.5.6 - /Users/sen/.deno/bin/deno Browsers: Chrome: 149.0.7827.103 Firefox: 151.0.4 Safari: 26.4Used Package Manager
yarn
Validations
Beta Was this translation helpful? Give feedback.
All reactions