Skip to content

perf: avoid creating unused workers#410

Merged
9aoy merged 1 commit intomainfrom
worker-number
Jul 23, 2025
Merged

perf: avoid creating unused workers#410
9aoy merged 1 commit intomainfrom
worker-number

Conversation

@9aoy
Copy link
Copy Markdown
Collaborator

@9aoy 9aoy commented Jul 22, 2025

Summary

Avoid creating unused workers when the number of tests is less than the default thread count.

This significantly improves performance when running a single test file.

before:

npx rstest run  1.29s user 0.45s system 85% cpu 2.031 total

after:

npx rstest run  0.72s user 0.26s system 86% cpu 1.137 total

Related Links

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Copilot AI review requested due to automatic review settings July 22, 2025 12:20
@netlify
Copy link
Copy Markdown

netlify bot commented Jul 22, 2025

Deploy Preview for rstest-dev ready!

Name Link
🔨 Latest commit 3331bea
🔍 Latest deploy log https://app.netlify.com/projects/rstest-dev/deploys/687f821283cf48000827a2f4
😎 Deploy Preview https://deploy-preview-410--rstest-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.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR optimizes worker pool creation by dynamically adjusting the number of workers based on the actual number of tests to run, avoiding the creation of unused workers when running fewer tests than the default thread count. This provides significant performance improvements for single test file execution.

  • Introduces dynamic worker count calculation based on test entries and command type
  • Modifies worker pool configuration to use the recommended count instead of static thread count
  • Maintains full thread utilization for watch mode while optimizing for single runs
Comments suppressed due to low confidence (1)

packages/core/src/pool/index.ts:85

  • [nitpick] The variable name 'recommendCount' is grammatically awkward. Consider renaming to 'recommendedCount' or 'optimalWorkerCount' for better clarity.
  const recommendCount =

@9aoy 9aoy merged commit 2de2d45 into main Jul 23, 2025
17 checks passed
@9aoy 9aoy deleted the worker-number branch July 23, 2025 03:04
@9aoy 9aoy mentioned this pull request Jul 24, 2025
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.

2 participants