Skip to content

Conversation

@hi-ogawa
Copy link
Contributor

@hi-ogawa hi-ogawa commented Dec 16, 2025

Description

This finally tries to optimize the persisted structure itself.

The raw data format is:

// files
[
  {
     id: "...",
     importDurations: {
        "imported-file-1": {
            seltTime: ...,
            totalTime: ...,
            external: ...,
            importer: ...,
         },
        "imported-file-2": {
            seltTime: ...,
            totalTime: ...,
            external: ...,
            importer: ...,
         },
     }
  },
  {
     id: "...",
     importDurations: {
        "imported-file-1": {
            seltTime: ...,
            totalTime: ...,
            external: ...,
            importer: ...,
         }
     }
  },
]

This PR squeezes this into something like:

// files
[
  {
     id: "...",
     ...
  },  
  {
     id: "...",
     ...
  },
  ...
]

// importDurations interned strings
["imported-file-1", "imported-file-2", ...]

// flat importDurations
{
  "id-1": [(index imported-file-1), (selfTime.toPrecision(3)), ..., ],
  "id-2": [...]
   ...
}

The original each key/value entry leads to about 150 bytes, but this squeezes into about 20 bytes. However, when considering the scale of the number of entries being (number of test files) x (number of source files), this approach cannot solve the inherent issues.

Result

See https://github.com/hi-ogawa/vitest-9216-repro/

(test files x source files) Blob Size
100 x 1000 239K
1000 x 1000 1.5M
  • v4.0.15 (with importDurations)
(test files x source files) Blob Size
100 x 1000 15 MB
1000 x 1000 ???
  • this PR
(test files x source files) Blob Size
100 x 1000 2.2M
1000 x 1000 23M

Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. If the feature is substantial or introduces breaking changes without a discussion, PR might be closed.
  • Ideally, include a test that fails without this PR but passes with it.
  • Please, don't make changes to pnpm-lock.yaml unless you introduce a new test example.
  • Please check Allow edits by maintainers to make review process faster. Note that this option is not available for repositories that are owned by Github organizations.

Tests

  • Run the tests with pnpm test:ci.

Documentation

  • If you introduce new functionality, document it. You can run documentation with pnpm run docs command.

Changesets

  • Changes in changelog are generated from PR name. Please, make sure that it explains your changes in an understandable manner. Please, prefix changeset messages with feat:, fix:, perf:, docs:, or chore:.

@netlify
Copy link

netlify bot commented Dec 16, 2025

Deploy Preview for vitest-dev ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 8a2cb0a
🔍 Latest deploy log https://app.netlify.com/projects/vitest-dev/deploys/6940d6fa5e935a00077788a1
😎 Deploy Preview https://deploy-preview-9265--vitest-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Dec 16, 2025

@vitest/browser

npm i https://pkg.pr.new/@vitest/browser@9265

@vitest/browser-playwright

npm i https://pkg.pr.new/@vitest/browser-playwright@9265

@vitest/browser-preview

npm i https://pkg.pr.new/@vitest/browser-preview@9265

@vitest/browser-webdriverio

npm i https://pkg.pr.new/@vitest/browser-webdriverio@9265

@vitest/coverage-istanbul

npm i https://pkg.pr.new/@vitest/coverage-istanbul@9265

@vitest/coverage-v8

npm i https://pkg.pr.new/@vitest/coverage-v8@9265

@vitest/expect

npm i https://pkg.pr.new/@vitest/expect@9265

@vitest/mocker

npm i https://pkg.pr.new/@vitest/mocker@9265

@vitest/pretty-format

npm i https://pkg.pr.new/@vitest/pretty-format@9265

@vitest/runner

npm i https://pkg.pr.new/@vitest/runner@9265

@vitest/snapshot

npm i https://pkg.pr.new/@vitest/snapshot@9265

@vitest/spy

npm i https://pkg.pr.new/@vitest/spy@9265

@vitest/ui

npm i https://pkg.pr.new/@vitest/ui@9265

@vitest/utils

npm i https://pkg.pr.new/@vitest/utils@9265

vitest

npm i https://pkg.pr.new/vitest@9265

@vitest/web-worker

npm i https://pkg.pr.new/@vitest/web-worker@9265

@vitest/ws-client

npm i https://pkg.pr.new/@vitest/ws-client@9265

commit: b9551bc

@netlify
Copy link

netlify bot commented Dec 16, 2025

Deploy Preview for vitest-dev ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 20234c4
🔍 Latest deploy log https://app.netlify.com/projects/vitest-dev/deploys/6940d730fd9a8800087664f4
😎 Deploy Preview https://deploy-preview-9265--vitest-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

hi-ogawa added a commit to hi-ogawa/vitest-9216-repro that referenced this pull request Dec 16, 2025
@hi-ogawa hi-ogawa mentioned this pull request Dec 16, 2025
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reporters data is bloated compared to v3.1.x

1 participant