Skip to content

perf: get workerId from a global object - #8507

Merged
sheremet-va merged 1 commit into
vitest-dev:mainfrom
sheremet-va:perf/dont-import-from-tinypool
Aug 29, 2025
Merged

sheremet-va merged 1 commit into
vitest-dev:mainfrom
sheremet-va:perf/dont-import-from-tinypool

Conversation

@sheremet-va

@sheremet-va sheremet-va commented Aug 29, 2025 •

Copy link
Copy Markdown
Member

Description

Importing from tinypool has a side effect of calling exec to get the number of cores that is not used anymore. We do that just to get a workerId number which we can also get from the global object instead.

This improves the startup performance for every worker by ~8ms on my PC.

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

netlify Bot commented Aug 29, 2025

Copy link
Copy Markdown

✅ Deploy Preview for vitest-dev ready!

Name Link
🔨 Latest commit b29f54d
🔍 Latest deploy log https://app.netlify.com/projects/vitest-dev/deploys/68b1e194b5dfa00008fb5cd5
😎 Deploy Preview https://deploy-preview-8507--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.

@sheremet-va sheremet-va changed the title perf: get workerId from a global object perf: get workerId from a global object Aug 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants