Skip to content
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 has too much memory usage in the face of a large number of benches #6539

Closed
6 tasks done
D-Sketon opened this issue Sep 20, 2024 · 1 comment · Fixed by #6541
Closed
6 tasks done

Vitest has too much memory usage in the face of a large number of benches #6539

D-Sketon opened this issue Sep 20, 2024 · 1 comment · Fixed by #6541
Labels
feat: benchmark Issues and PRs related to the benchmark feature p3-minor-bug An edge case that only affects very specific usage (priority)

Comments

@D-Sketon
Copy link

Describe the bug

ref: #6535

I'm a contributor of es-toolkit. When I try to run about 200+ bench.ts using yarn vitest bench, the memory footprint is too high. I allocated 26000mb of memory for the node and it still crashes.
image
benchmark: https://github.com/toss/es-toolkit/tree/main/benchmarks/performance

Reproduction

System Info

System:
    OS: Windows 11 10.0.22631
    CPU: (16) x64 13th Gen Intel(R) Core(TM) i5-13400F
    Memory: 20.48 GB / 31.82 GB
  Binaries:
    Node: 20.13.1 - D:\nodejs\node.EXE
    Yarn: 4.2.2 - D:\nodejs\yarn.CMD
    npm: 10.5.2 - D:\nodejs\npm.CMD
    bun: 1.1.27 - D:\nodejs\bun.CMD
  Browsers:
    Edge: Chromium (127.0.2651.74)
    Internet Explorer: 11.0.22621.3527
  npmPackages:
    @vitest/coverage-istanbul: ^1.5.2 => 1.5.2
    vitest: ^1.5.2 => 1.5.2

Used Package Manager

yarn

Validations

@hi-ogawa hi-ogawa added feat: benchmark Issues and PRs related to the benchmark feature p3-minor-bug An edge case that only affects very specific usage (priority) and removed pending triage labels Sep 20, 2024
@hi-ogawa
Copy link
Contributor

hi-ogawa commented Sep 21, 2024

Since the default reporter doesn't need entire samples array, we can probably free it early and only keep track of samplesCount instead.

Reproduction by generating bench files https://stackblitz.com/edit/vitest-dev-vitest-7ovbya?file=src%2Fgen.mjs

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feat: benchmark Issues and PRs related to the benchmark feature p3-minor-bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants