Skip to content

Vitest 3 runs 3 times slower than Vitest 2 #7285

@TheJaredWilcurt

Description

@TheJaredWilcurt

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

12 second details:

  System:
    OS: Linux 6.8 Ubuntu 24.04.1 LTS 24.04.1 LTS (Noble Numbat)
    CPU: (2) x64 Intel(R) Core(TM) i7-6600U CPU @ 2.60GHz
    Memory: 4.84 GB / 7.71 GB
    Container: Yes
    Shell: 5.2.21 - /bin/bash
  Binaries:
    Node: 23.6.0 - ~/.volta/tools/image/node/23.6.0/bin/node
    npm: 11.0.0 - ~/.volta/tools/image/npm/11.0.0/bin/npm
  npmPackages:
    @vitejs/plugin-vue: ^5.2.1 => 5.2.1 
    @vitest/coverage-v8: ^2.1.8 => 2.1.8 
    vitest: ^2.1.8 => 2.1.8 


36 second details:

  System:
    OS: Linux 6.8 Ubuntu 24.04.1 LTS 24.04.1 LTS (Noble Numbat)
    CPU: (2) x64 Intel(R) Core(TM) i7-6600U CPU @ 2.60GHz
    Memory: 4.82 GB / 7.71 GB
    Container: Yes
    Shell: 5.2.21 - /bin/bash
  Binaries:
    Node: 23.6.0 - ~/.volta/tools/image/node/23.6.0/bin/node
    npm: 11.0.0 - ~/.volta/tools/image/npm/11.0.0/bin/npm
  npmPackages:
    @vitejs/plugin-vue: ^5.2.1 => 5.2.1 
    @vitest/coverage-v8: ^3.0.2 => 3.0.2 
    vitest: ^3.0.2 => 3.0.2

Used Package Manager

npm

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions