-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vitest 3 runs 3 times slower than Vitest 2 #7285
Comments
We upgraded it also to v3 and the tests execution went from 17s locally to almost 70s |
By annoying and distracting flashing, do you mean the summary? Use following to disable it: https://vitest.dev/guide/reporters.html#built-in-reporters
|
Confirmed, applying the Though honestly, I'd rather have the summary on, but the duration off. Since the duration is what makes the performance slow, and also is annoying to look at. Basically "exactly like it was in v2". |
How did you narrow down the root cause to the Testing your reproduction on Github Codespace with
Does this recording demonstrate the annoying and distracting flashing you mentioned? I'm not sure I see it but might be just biased. 🤔 vitest-maybe-flickering.webm |
We also have a test suite where we run 5000 test files with total of 20000 test cases. This test suite enables these interactively updating reporters even on CI (using
|
the live update of "Duration" timer also caused some issues for me when running tests inside pre-push hook and logging results to stdout. Each update creates a new entry in stdout creating lots of noise. |
You can see the redraws/repaints being done by the terminal/command prompt. Because the duration is updating so frequently, it is causing flashing to occur more often. My assumption is it is also related to the performance issue, as I've seen this same outcome from other CLI's in the past. Also turning summary off seems to confirm this suspicion. I absolutely want a |
In Vitest 2 we used to repaint whole terminal window every 16ms. Now the repainting is limited to only the summary. We've actually seen improved reporting performance now. What terminal is that? I have some improvement ideas but before that I need to be able to reproduce this issue. Your reproduction works fine on Github Codespaces, running on Ubuntu. I would expect that to match your reported environment
@fmal please create new issues for reports that are unrelated to this one. Let's keep this one focusing on Vitest 3 performance only, as the title says. |
Original report is on an old laptop running Ubuntu in a VM. So it's a much slower than normal environment to begin with. Using default terminal, no tweaks/modifications. The GIF was created on Windows using |
There's preview release that you can try now: npm i https://pkg.pr.new/vitest@7291 |
Trying with
Setting
So about the same. So this PR removes the difference in performance between enabling/disabling Summary. Switching back to
Switching back to
So this seems fixed to me! |
Also the "flashing" seems to have gone away too, so I no longer need a |
Awesome, thanks for testing. If possible, could you record similar gif as in #7285 (comment) with the preview release? I'm just interested to see how it looks now. I'm unable to reproduce that kind of flickering terminal output myself. |
Yip that improves the speed. Thank you! |
@boldurean cool, then you had the same issue as me. There is a PR up to resolve it (#7291), so you won't need to turn off the summary after that is merged/released. |
Describe the bug
My unit tests took ~12 seconds on the latest v2 of Vitest, then switching to v3, they now take ~36.5 seconds to run locally. Importantly they went from 3.2 seconds to 3.0 seconds on CI (GHA).
My assumption is this local slowdown is caused by the live update "Duration" timer constantly refreshing the terminal multiple times a second. From my experience in the past, these constant update severely slow down running tasks. On Windows for example, minimizing a command prompt will cause it to run faster as it stops performing repaints. On Ubuntu, minimizing the terminal actually caused it to go much slower (~65 seconds). I assume minimized windows on Ubuntu are given less resources?
I looked around but couldn't find any way to turn the "Duration" field off when running tests. This would be a good option even if it is unrelated to performance because I just don't like it. It's annoying and distracting to have something constantly flashing. I don't care how long it's been running, I care how long it took at the end (and only very rarely).
Reproduction
This is the library repo I'm working on where I noticed this:
System Info
Used Package Manager
npm
Validations
The text was updated successfully, but these errors were encountered: