Skip to content

Commit d30a583

Browse files
Trottjasnell
authored andcommittedSep 20, 2017
benchmark: provide default methods for assert
The benchmarks for `assert` all take a `method` configuration option, but the allowable values are different across the files. For each benchmark, provide an arbitrary default if `method` is set to an empty string. This allows all the `assert` benchmarks to be run with a single command but only on a single method. This is primarily useful for testing that the assert benchmark files don't contain egregious errors. (In other words, it's useful for testing.) PR-URL: #15174 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent b5c1a82 commit d30a583

8 files changed

+16
-0
lines changed
 

‎benchmark/assert/deepequal-buffer.js

+2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ function main(conf) {
2727
data.copy(expectedWrong);
2828

2929
switch (conf.method) {
30+
case '':
31+
// Empty string falls through to next line as default, mostly for tests.
3032
case 'deepEqual':
3133
bench.start();
3234
for (i = 0; i < n; ++i) {

‎benchmark/assert/deepequal-map.js

+2
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ function main(conf) {
4646
var values, values2;
4747

4848
switch (conf.method) {
49+
case '':
50+
// Empty string falls through to next line as default, mostly for tests.
4951
case 'deepEqual_primitiveOnly':
5052
values = array.map((_, i) => [`str_${i}`, 123]);
5153
benchmark(assert.deepEqual, n, values);

‎benchmark/assert/deepequal-object.js

+2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ function main(conf) {
3737
const expectedWrong = createObj(source, '4');
3838

3939
switch (conf.method) {
40+
case '':
41+
// Empty string falls through to next line as default, mostly for tests.
4042
case 'deepEqual':
4143
bench.start();
4244
for (i = 0; i < n; ++i) {

‎benchmark/assert/deepequal-prims-and-objs-big-array-set.js

+2
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ function main(conf) {
5353
const expectedWrongSet = new Set(expectedWrong);
5454

5555
switch (conf.method) {
56+
case '':
57+
// Empty string falls through to next line as default, mostly for tests.
5658
case 'deepEqual_Array':
5759
bench.start();
5860
for (i = 0; i < n; ++i) {

‎benchmark/assert/deepequal-prims-and-objs-big-loop.js

+2
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ function main(conf) {
3434

3535
// Creates new array to avoid loop invariant code motion
3636
switch (conf.method) {
37+
case '':
38+
// Empty string falls through to next line as default, mostly for tests.
3739
case 'deepEqual':
3840
bench.start();
3941
for (i = 0; i < n; ++i) {

‎benchmark/assert/deepequal-set.js

+2
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ function main(conf) {
4747
var values, values2;
4848

4949
switch (conf.method) {
50+
case '':
51+
// Empty string falls through to next line as default, mostly for tests.
5052
case 'deepEqual_primitiveOnly':
5153
values = array.map((_, i) => `str_${i}`);
5254
benchmark(assert.deepEqual, n, values);

‎benchmark/assert/deepequal-typedarrays.js

+2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ function main(conf) {
3737
var i;
3838

3939
switch (conf.method) {
40+
case '':
41+
// Empty string falls through to next line as default, mostly for tests.
4042
case 'deepEqual':
4143
bench.start();
4244
for (i = 0; i < n; ++i) {

‎benchmark/assert/throws.js

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ function main(conf) {
2222
var i;
2323

2424
switch (conf.method) {
25+
case '':
26+
// Empty string falls through to next line as default, mostly for tests.
2527
case 'doesNotThrow':
2628
bench.start();
2729
for (i = 0; i < n; ++i) {

0 commit comments

Comments
 (0)