Skip to content

Commit ddb8824

Browse files
BridgeARMylesBorins
authored andcommitted
benchmark: remove special test entries
This reverts commit 7cfbc9f. PR-URL: #31755 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Vladimir de Turckheim <[email protected]> Reviewed-By: Rich Trott <[email protected]>
1 parent 92cc406 commit ddb8824

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+15
-81
lines changed

benchmark/assert/deepequal-buffer.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,10 @@ const bench = common.createBenchmark(main, {
66
n: [2e4],
77
len: [1e2, 1e3],
88
strict: [0, 1],
9-
method: [ 'deepEqual', 'notDeepEqual' ],
9+
method: ['deepEqual', 'notDeepEqual'],
1010
});
1111

1212
function main({ len, n, method, strict }) {
13-
if (!method)
14-
method = 'deepEqual';
1513
const data = Buffer.allocUnsafe(len + 1);
1614
const actual = Buffer.alloc(len);
1715
const expected = Buffer.alloc(len);

benchmark/assert/deepequal-map.js

-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ function main({ n, len, method, strict }) {
3434
const array = Array(len).fill(1);
3535

3636
switch (method) {
37-
case '':
38-
// Empty string falls through to next line as default, mostly for tests.
3937
case 'deepEqual_primitiveOnly': {
4038
const values = array.map((_, i) => [`str_${i}`, 123]);
4139
benchmark(strict ? deepStrictEqual : deepEqual, n, values);

benchmark/assert/deepequal-object.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const bench = common.createBenchmark(main, {
77
n: [5e3],
88
size: [1e2, 1e3, 5e4],
99
strict: [0, 1],
10-
method: [ 'deepEqual', 'notDeepEqual' ],
10+
method: ['deepEqual', 'notDeepEqual'],
1111
});
1212

1313
function createObj(source, add = '') {
@@ -27,9 +27,6 @@ function main({ size, n, method, strict }) {
2727
// TODO: Fix this "hack". `n` should not be manipulated.
2828
n = Math.min(Math.ceil(n / size), 20);
2929

30-
if (!method)
31-
method = 'deepEqual';
32-
3330
const source = Array.apply(null, Array(size));
3431
const actual = createObj(source);
3532
const expected = createObj(source);

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

-2
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ function main({ n, len, primitive, method, strict }) {
5252
const expectedWrongSet = new Set(expectedWrong);
5353

5454
switch (method) {
55-
// Empty string falls through to next line as default, mostly for tests.
56-
case '':
5755
case 'deepEqual_Array':
5856
run(strict ? deepStrictEqual : deepEqual, n, actual, expected);
5957
break;

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

+1-3
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,10 @@ const bench = common.createBenchmark(main, {
1313
primitive: Object.keys(primValues),
1414
n: [2e4],
1515
strict: [0, 1],
16-
method: [ 'deepEqual', 'notDeepEqual' ],
16+
method: ['deepEqual', 'notDeepEqual'],
1717
});
1818

1919
function main({ n, primitive, method, strict }) {
20-
if (!method)
21-
method = 'deepEqual';
2220
const prim = primValues[primitive];
2321
const actual = prim;
2422
const expected = prim;

benchmark/assert/deepequal-set.js

-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ function main({ n, len, method, strict }) {
3434
const array = Array(len).fill(1);
3535

3636
switch (method) {
37-
case '':
38-
// Empty string falls through to next line as default, mostly for tests.
3937
case 'deepEqual_primitiveOnly': {
4038
const values = array.map((_, i) => `str_${i}`);
4139
benchmark(strict ? deepStrictEqual : deepEqual, n, values);

benchmark/assert/deepequal-typedarrays.js

-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ const bench = common.createBenchmark(main, {
2020
});
2121

2222
function main({ type, n, len, method, strict }) {
23-
if (!method)
24-
method = 'deepEqual';
2523
const clazz = global[type];
2624
const actual = new clazz(len);
2725
const expected = new clazz(len);

benchmark/assert/throws.js

-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ function main({ n, method }) {
1515
const message = 'failure';
1616

1717
switch (method) {
18-
case '':
19-
// Empty string falls through to next line as default, mostly for tests.
2018
case 'doesNotThrow':
2119
bench.start();
2220
for (let i = 0; i < n; ++i) {

benchmark/buffers/buffer-bytelength.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ const chars = [
1717

1818
function main({ n, len, encoding }) {
1919
let strings = [];
20-
let results = [ len * 16 ];
20+
let results = [len * 16];
2121
if (encoding === 'buffer') {
22-
strings = [ Buffer.alloc(len * 16, 'a') ];
22+
strings = [Buffer.alloc(len * 16, 'a')];
2323
} else {
2424
for (const string of chars) {
2525
// Strings must be built differently, depending on encoding

benchmark/buffers/buffer-creation.js

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ const bench = common.createBenchmark(main, {
1616
function main({ len, n, type }) {
1717
let fn, i;
1818
switch (type) {
19-
case '':
2019
case 'fast-alloc':
2120
fn = Buffer.alloc;
2221
break;

benchmark/buffers/buffer-fill.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function main({ n, type, size }) {
2222
const buffer = Buffer.allocUnsafe(size);
2323
const testFunction = new Function('b', `
2424
for (var i = 0; i < ${n}; i++) {
25-
b.${type || 'fill(0)'};
25+
b.${type};
2626
}
2727
`);
2828
bench.start();

benchmark/buffers/buffer-iterate.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function main({ size, type, method, n }) {
2121
Buffer.alloc(size) :
2222
SlowBuffer(size).fill(0);
2323

24-
const fn = methods[method || 'for'];
24+
const fn = methods[method];
2525

2626
bench.start();
2727
fn(buffer, n);

benchmark/buffers/buffer-read-float.js

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ const bench = common.createBenchmark(main, {
99
});
1010

1111
function main({ n, type, endian, value }) {
12-
type = type || 'Double';
1312
const buff = Buffer.alloc(8);
1413
const fn = `read${type}${endian}`;
1514
const values = {

benchmark/buffers/buffer-read-with-byteLength.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function main({ n, buf, type, byteLength }) {
1919
const buff = buf === 'fast' ?
2020
Buffer.alloc(8) :
2121
require('buffer').SlowBuffer(8);
22-
const fn = `read${type || 'IntBE'}`;
22+
const fn = `read${type}`;
2323

2424
buff.writeDoubleLE(0, 0);
2525
bench.start();

benchmark/buffers/buffer-read.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ function main({ n, buf, type }) {
2828
const buff = buf === 'fast' ?
2929
Buffer.alloc(8) :
3030
require('buffer').SlowBuffer(8);
31-
const fn = `read${type || 'UInt8'}`;
31+
const fn = `read${type}`;
3232

3333
buff.writeDoubleLE(0, 0);
3434
bench.start();

benchmark/buffers/buffer-swap.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ function genMethod(method) {
7676

7777
function main({ method, len, n, aligned = 'true' }) {
7878
const buf = createBuffer(len, aligned === 'true');
79-
const bufferSwap = genMethod(method || 'swap16');
79+
const bufferSwap = genMethod(method);
8080

8181
bufferSwap(n, buf);
8282
bench.start();

benchmark/buffers/buffer-write.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ function main({ n, buf, type }) {
7474
const buff = buf === 'fast' ?
7575
Buffer.alloc(8) :
7676
require('buffer').SlowBuffer(8);
77-
const fn = `write${type || 'UInt8'}`;
77+
const fn = `write${type}`;
7878

7979
if (!/\d/.test(fn))
8080
benchSpecialInt(buff, fn, n);

benchmark/buffers/dataview-set.js

-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ const mod = {
4040
};
4141

4242
function main({ n, type }) {
43-
type = type || 'Uint8';
4443
const ab = new ArrayBuffer(8);
4544
const dv = new DataView(ab, 0, 8);
4645
const le = /LE$/.test(type);

benchmark/crypto/aes-gcm-throughput.js

-3
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ const bench = common.createBenchmark(main, {
99
});
1010

1111
function main({ n, len, cipher }) {
12-
// Default cipher for tests.
13-
if (cipher === '')
14-
cipher = 'aes-128-gcm';
1512
const message = Buffer.alloc(len, 'b');
1613
const key = crypto.randomBytes(keylen[cipher]);
1714
const iv = crypto.randomBytes(12);

benchmark/crypto/cipher-stream.js

+1-5
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const common = require('../common.js');
33

44
const bench = common.createBenchmark(main, {
55
writes: [500],
6-
cipher: [ 'AES192', 'AES256' ],
6+
cipher: ['AES192', 'AES256'],
77
type: ['asc', 'utf', 'buf'],
88
len: [2, 1024, 102400, 1024 * 1024],
99
api: ['legacy', 'stream']
@@ -12,9 +12,6 @@ const bench = common.createBenchmark(main, {
1212
});
1313

1414
function main({ api, cipher, type, len, writes }) {
15-
// Default cipher for tests.
16-
if (cipher === '')
17-
cipher = 'AES192';
1815
if (api === 'stream' && /^v0\.[0-8]\./.test(process.version)) {
1916
console.error('Crypto streams not available until v0.10');
2017
// Use the legacy, just so that we can compare them.
@@ -29,7 +26,6 @@ function main({ api, cipher, type, len, writes }) {
2926
alice.generateKeys();
3027
bob.generateKeys();
3128

32-
3329
const pubEnc = /^v0\.[0-8]/.test(process.version) ? 'binary' : null;
3430
const alice_secret = alice.computeSecret(bob.getPublicKey(), pubEnc, 'hex');
3531
const bob_secret = bob.computeSecret(alice.getPublicKey(), pubEnc, 'hex');

benchmark/es/defaultparams-bench.js

-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ function runDefaultParams(n) {
3636

3737
function main({ n, method }) {
3838
switch (method) {
39-
case '':
40-
// Empty string falls through to next line as default, mostly for tests.
4139
case 'withoutdefaults':
4240
runOldStyleDefaults(n);
4341
break;

benchmark/es/destructuring-bench.js

-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ function runSwapDestructured(n) {
3636

3737
function main({ n, method }) {
3838
switch (method) {
39-
case '':
40-
// Empty string falls through to next line as default, mostly for tests.
4139
case 'swap':
4240
runSwapManual(n);
4341
break;

benchmark/es/destructuring-object-bench.js

-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ function runDestructured(n) {
3333

3434
function main({ n, method }) {
3535
switch (method) {
36-
case '':
37-
// Empty string falls through to next line as default, mostly for tests.
3836
case 'normal':
3937
runNormal(n);
4038
break;

benchmark/es/foreach-bench.js

-2
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@ function main({ n, count, method }) {
5454
items[i] = i;
5555

5656
switch (method) {
57-
case '':
58-
// Empty string falls through to next line as default, mostly for tests.
5957
case 'for':
6058
fn = useFor;
6159
break;

benchmark/es/map-bench.js

-2
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,6 @@ function runMap(n) {
104104

105105
function main({ n, method }) {
106106
switch (method) {
107-
case '':
108-
// Empty string falls through to next line as default, mostly for tests.
109107
case 'object':
110108
runObject(n);
111109
break;

benchmark/es/restparams-bench.js

-2
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ function runUseArguments(n) {
5151
function main({ n, method }) {
5252
let fn;
5353
switch (method) {
54-
case '':
55-
// Empty string falls through to next line as default, mostly for tests.
5654
case 'copy':
5755
fn = runCopyArguments;
5856
break;

benchmark/es/spread-assign.js

-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ function main({ n, context, count, rest, method }) {
1818
let obj; // eslint-disable-line no-unused-vars
1919

2020
switch (method) {
21-
case '':
22-
// Empty string falls through to next line as default, mostly for tests.
2321
case '_extend':
2422
bench.start();
2523
for (let i = 0; i < n; i++)

benchmark/es/spread-bench.js

-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ function main({ n, context, count, rest, method }) {
3232
args[i] = i;
3333

3434
switch (method) {
35-
case '':
36-
// Empty string falls through to next line as default, mostly for tests.
3735
case 'apply':
3836
bench.start();
3937
for (let i = 0; i < n; i++)

benchmark/es/string-concatenations.js

-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ function main({ n, mode }) {
2323
let string;
2424

2525
switch (mode) {
26-
case '':
27-
// Empty string falls through to next line as default, mostly for tests.
2826
case 'multi-concat':
2927
bench.start();
3028
for (let i = 0; i < n; i++)

benchmark/es/string-repeat.js

-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ function main({ n, size, encoding, mode }) {
1818
let str;
1919

2020
switch (mode) {
21-
case '':
22-
// Empty string falls through to next line as default, mostly for tests.
2321
case 'Array':
2422
bench.start();
2523
for (let i = 0; i < n; i++)

benchmark/misc/arguments.js

-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ function usingPredefined() {
3434
function main({ n, method, args }) {
3535
let fn;
3636
switch (method) {
37-
// '' is a default case for tests
38-
case '':
3937
case 'restAndSpread':
4038
fn = usingRestAndSpread;
4139
break;

benchmark/misc/getstringwidth.js

-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ const bench = common.createBenchmark(main, {
1010
});
1111

1212
function main({ n, type }) {
13-
// Default value for testing purposes.
14-
type = type || 'ascii';
1513
const { getStringWidth } = require('internal/util/inspect');
1614

1715
const str = ({

benchmark/misc/object-property-bench.js

-2
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,6 @@ function runSymbol(n) {
6464
function main({ n, method }) {
6565

6666
switch (method) {
67-
// '' is a default case for tests
68-
case '':
6967
case 'property':
7068
runProperty(n);
7169
break;

benchmark/misc/punycode.js

-2
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@ function runICU(n, val) {
6262

6363
function main({ n, val, method }) {
6464
switch (method) {
65-
// '' is a default case for tests
66-
case '':
6765
case 'punycode':
6866
runPunycode(n, val);
6967
break;

benchmark/misc/trace.js

-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ function main({ n, method }) {
4141
} = common.binding('trace_events');
4242

4343
switch (method) {
44-
case '':
4544
case 'trace':
4645
doTrace(n, trace);
4746
break;

benchmark/misc/util-extend-vs-object-assign.js

-4
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@ const bench = common.createBenchmark(main, {
99
});
1010

1111
function main({ n, type }) {
12-
// Default value for tests.
13-
if (type === '')
14-
type = 'extend';
15-
1612
let fn;
1713
if (type === 'extend') {
1814
fn = util._extend;

benchmark/url/url-format.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const bench = common.createBenchmark(main, {
1313
});
1414

1515
function main({ type, n }) {
16-
const input = inputs[type] || '';
16+
const input = inputs[type];
1717

1818
// Force-optimize url.format() so that the benchmark doesn't get
1919
// disrupted by the optimizer kicking in halfway through.

benchmark/url/url-parse.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const bench = common.createBenchmark(main, {
1313
});
1414

1515
function main({ type, n }) {
16-
const input = inputs[type] || '';
16+
const input = inputs[type];
1717

1818
bench.start();
1919
for (let i = 0; i < n; i += 1)

benchmark/util/format.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ const bench = common.createBenchmark(main, {
2323
});
2424

2525
function main({ n, type }) {
26-
// For testing, if supplied with an empty type, default to string.
27-
const [first, second] = inputs[type || 'string'];
26+
const [first, second] = inputs[type];
2827

2928
bench.start();
3029
for (let i = 0; i < n; i++) {

0 commit comments

Comments
 (0)