-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
benchmark: add benchmarks for the test_runner #48931
Merged
nodejs-github-bot
merged 9 commits into
nodejs:main
from
rluvaton:add-test-runner-benchmarks
Jul 29, 2023
Merged
Changes from 3 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
8700926
benchmark: add benchmarks for the test_runner
rluvaton 4781ca7
remove todo
rluvaton d9e9b1c
remove 1K suites due to OOM in conjunction with 1K tests per suite
rluvaton a67b01d
rename files
rluvaton 82e20f7
sync and async tests
rluvaton 1308c10
sync and async tests
rluvaton 929e0d2
add concurrency options
rluvaton dbb1380
trigger GitHub Actions CI
rluvaton 994e575
avoid v8 optimization
rluvaton File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
const { PassThrough } = require('node:stream'); | ||
|
||
module.exports = new PassThrough({ | ||
objectMode: true, | ||
transform(chunk, encoding, callback) { | ||
callback(null) | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
'use strict'; | ||
const common = require('../common'); | ||
const { it } = require('node:test'); | ||
|
||
const bench = common.createBenchmark(main, { | ||
n: [100, 1000, 1e4], | ||
}, { | ||
// We don't want to test the reporter here | ||
flags: ['--test-reporter=./benchmark/fixtures/empty-test-reporter.js'], | ||
}); | ||
|
||
async function run(n) { | ||
const promises = new Array(n); | ||
for (let i = 0; i < n; i++) { | ||
promises[i] = it(`${i}`, () => { | ||
}); | ||
} | ||
|
||
await Promise.all(promises); | ||
} | ||
|
||
function main({ n }) { | ||
bench.start(); | ||
run(n).then(() => { | ||
bench.end(n); | ||
}); | ||
} |
25 changes: 25 additions & 0 deletions
25
benchmark/test_runner/plain-tests-waiting-for-each-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
'use strict'; | ||
const common = require('../common'); | ||
const { it } = require('node:test'); | ||
|
||
|
||
const bench = common.createBenchmark(main, { | ||
n: [100, 1000, 1e4], | ||
}, { | ||
// We don't want to test the reporter here | ||
flags: ['--test-reporter=./benchmark/fixtures/empty-test-reporter.js'], | ||
}); | ||
|
||
async function run(n) { | ||
for (let i = 0; i < n; i++) { | ||
await it(`${i}`, () => { | ||
}); | ||
} | ||
} | ||
|
||
function main({ n }) { | ||
bench.start(); | ||
run(n).then(() => { | ||
bench.end(n); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
'use strict'; | ||
const common = require('../common'); | ||
const { finished } = require('node:stream/promises'); | ||
|
||
const reporter = require('../fixtures/empty-test-reporter'); | ||
|
||
const { describe, it } = require('node:test'); | ||
|
||
const bench = common.createBenchmark(main, { | ||
numberOfSuites: [10, 100], | ||
testsPerSuite: [10, 100, 1000], | ||
}, { | ||
// We don't want to test the reporter here | ||
flags: ['--test-reporter=./benchmark/fixtures/empty-test-reporter.js'], | ||
}); | ||
|
||
async function run(numberOfSuites, testsPerSuite) { | ||
for (let i = 0; i < numberOfSuites; i++) { | ||
describe(`${i}`, () => { | ||
for (let j = 0; j < testsPerSuite; j++) { | ||
it(`${j}`, () => { | ||
}); | ||
} | ||
}); | ||
} | ||
|
||
await finished(reporter); | ||
|
||
return numberOfSuites * testsPerSuite; | ||
} | ||
|
||
function main({ numberOfSuites, testsPerSuite }) { | ||
bench.start(); | ||
run(numberOfSuites, testsPerSuite).then((ops) => { | ||
bench.end(ops); | ||
}); | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we use
finished
on the reporter or this?