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

test_runner: disable highWatermark on TestsStream #52287

Merged
merged 1 commit into from
Apr 2, 2024

Conversation

cjihrig
Copy link
Contributor

@cjihrig cjihrig commented Mar 31, 2024

The default highWatermark of 16 on the TestsStream class can have a substantial impact on reporting performance. This commit sets the TestsStream highWatermark to a very large value and lets the destination streams (which are more likely to have meaningful highWatermarks) handle backpressure.

To test this, I ran the following code:

'use strict';
const { describe, it } = require('node:test');

for (let i = 0; i < 100; ++i) {
  describe(`suite ${i + 1}`, () => {
    for (let j = 0; j < 100; ++j) {
      it(`test ${i + 1}-${j + 1}`, () => {});
    }
  });
}

Running the command time ./node test.js on my machine before and after this change yielded:

Before this change:

  • With --test: 2.12 seconds
  • Without --test: 1.43 seconds

After this change:

  • With --test: 0.94 seconds
  • Without --test: 0.42 seconds

For reference, mocha (time ./node ./node_modules/.bin/mocha test.js, with the node:test import removed) yielded 0.95 seconds.

The default highWatermark of 16 on the TestsStream class can
have a substantial impact on reporting performance. This commit
sets the TestsStream highWatermark to a very large value and
lets the destination streams (which are more likely to have
meaningful highWatermarks) handle backpressure.
@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/test_runner

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. test_runner labels Mar 31, 2024
Copy link
Member

@MoLow MoLow left a comment

Choose a reason for hiding this comment

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

amazing

@MoLow MoLow added the request-ci Add this label to start a Jenkins CI on a PR. label Mar 31, 2024
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Mar 31, 2024
@nodejs-github-bot
Copy link
Collaborator

@cjihrig cjihrig added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. commit-queue Add this label to land a pull request using GitHub Actions. and removed needs-ci PRs that need a full CI run. labels Mar 31, 2024
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Apr 2, 2024
@nodejs-github-bot nodejs-github-bot merged commit 2c024cd into nodejs:main Apr 2, 2024
66 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in 2c024cd

@cjihrig cjihrig deleted the hwm branch April 2, 2024 03:38
marco-ippolito pushed a commit that referenced this pull request May 2, 2024
The default highWatermark of 16 on the TestsStream class can
have a substantial impact on reporting performance. This commit
sets the TestsStream highWatermark to a very large value and
lets the destination streams (which are more likely to have
meaningful highWatermarks) handle backpressure.

PR-URL: #52287
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
marco-ippolito pushed a commit that referenced this pull request May 3, 2024
The default highWatermark of 16 on the TestsStream class can
have a substantial impact on reporting performance. This commit
sets the TestsStream highWatermark to a very large value and
lets the destination streams (which are more likely to have
meaningful highWatermarks) handle backpressure.

PR-URL: #52287
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
lukins-cz pushed a commit to lukins-cz/OS-Aplet-node that referenced this pull request Jun 1, 2024
The default highWatermark of 16 on the TestsStream class can
have a substantial impact on reporting performance. This commit
sets the TestsStream highWatermark to a very large value and
lets the destination streams (which are more likely to have
meaningful highWatermarks) handle backpressure.

PR-URL: nodejs#52287
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. test_runner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants