benchmark: use consistent coding style in assert/*
Files in benchmark/assert/* were sometimes using trailing commas for multi-line objects and sometimes not, mixing the approaches in the same file sometimes. Standardize these files to always use trailing commas in multi-line objects. Additionally, remove some unnecessary line-wrapping (so that there are fewer multi-line objects). PR-URL: https://github.com/nodejs/node/pull/25865 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
This commit is contained in:
parent
4deb23a2f6
commit
3418956349
@ -6,10 +6,7 @@ const bench = common.createBenchmark(main, {
|
|||||||
n: [2e4],
|
n: [2e4],
|
||||||
len: [1e2, 1e3],
|
len: [1e2, 1e3],
|
||||||
strict: [0, 1],
|
strict: [0, 1],
|
||||||
method: [
|
method: [ 'deepEqual', 'notDeepEqual' ],
|
||||||
'deepEqual',
|
|
||||||
'notDeepEqual'
|
|
||||||
]
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function main({ len, n, method, strict }) {
|
function main({ len, n, method, strict }) {
|
||||||
|
@ -14,8 +14,8 @@ const bench = common.createBenchmark(main, {
|
|||||||
'deepEqual_mixed',
|
'deepEqual_mixed',
|
||||||
'notDeepEqual_primitiveOnly',
|
'notDeepEqual_primitiveOnly',
|
||||||
'notDeepEqual_objectOnly',
|
'notDeepEqual_objectOnly',
|
||||||
'notDeepEqual_mixed'
|
'notDeepEqual_mixed',
|
||||||
]
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
function benchmark(method, n, values, values2) {
|
function benchmark(method, n, values, values2) {
|
||||||
|
@ -7,10 +7,7 @@ const bench = common.createBenchmark(main, {
|
|||||||
n: [5e3],
|
n: [5e3],
|
||||||
size: [1e2, 1e3, 5e4],
|
size: [1e2, 1e3, 5e4],
|
||||||
strict: [0, 1],
|
strict: [0, 1],
|
||||||
method: [
|
method: [ 'deepEqual', 'notDeepEqual' ],
|
||||||
'deepEqual',
|
|
||||||
'notDeepEqual'
|
|
||||||
]
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function createObj(source, add = '') {
|
function createObj(source, add = '') {
|
||||||
@ -21,8 +18,8 @@ function createObj(source, add = '') {
|
|||||||
a: [1, 2, 3],
|
a: [1, 2, 3],
|
||||||
baz: n,
|
baz: n,
|
||||||
c: {},
|
c: {},
|
||||||
b: []
|
b: [],
|
||||||
}
|
},
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ const primValues = {
|
|||||||
'string': 'a',
|
'string': 'a',
|
||||||
'number': 1,
|
'number': 1,
|
||||||
'object': { 0: 'a' },
|
'object': { 0: 'a' },
|
||||||
'array': [1, 2, 3]
|
'array': [1, 2, 3],
|
||||||
};
|
};
|
||||||
|
|
||||||
const bench = common.createBenchmark(main, {
|
const bench = common.createBenchmark(main, {
|
||||||
@ -20,8 +20,8 @@ const bench = common.createBenchmark(main, {
|
|||||||
'deepEqual_Array',
|
'deepEqual_Array',
|
||||||
'notDeepEqual_Array',
|
'notDeepEqual_Array',
|
||||||
'deepEqual_Set',
|
'deepEqual_Set',
|
||||||
'notDeepEqual_Set'
|
'notDeepEqual_Set',
|
||||||
]
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
function run(fn, n, actual, expected) {
|
function run(fn, n, actual, expected) {
|
||||||
|
@ -6,17 +6,14 @@ const primValues = {
|
|||||||
'string': 'a',
|
'string': 'a',
|
||||||
'number': 1,
|
'number': 1,
|
||||||
'object': { 0: 'a' },
|
'object': { 0: 'a' },
|
||||||
'array': [1, 2, 3]
|
'array': [1, 2, 3],
|
||||||
};
|
};
|
||||||
|
|
||||||
const bench = common.createBenchmark(main, {
|
const bench = common.createBenchmark(main, {
|
||||||
primitive: Object.keys(primValues),
|
primitive: Object.keys(primValues),
|
||||||
n: [2e4],
|
n: [2e4],
|
||||||
strict: [0, 1],
|
strict: [0, 1],
|
||||||
method: [
|
method: [ 'deepEqual', 'notDeepEqual' ],
|
||||||
'deepEqual',
|
|
||||||
'notDeepEqual',
|
|
||||||
]
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function main({ n, primitive, method, strict }) {
|
function main({ n, primitive, method, strict }) {
|
||||||
|
@ -14,8 +14,8 @@ const bench = common.createBenchmark(main, {
|
|||||||
'deepEqual_mixed',
|
'deepEqual_mixed',
|
||||||
'notDeepEqual_primitiveOnly',
|
'notDeepEqual_primitiveOnly',
|
||||||
'notDeepEqual_objectOnly',
|
'notDeepEqual_objectOnly',
|
||||||
'notDeepEqual_mixed'
|
'notDeepEqual_mixed',
|
||||||
]
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
function benchmark(method, n, values, values2) {
|
function benchmark(method, n, values, values2) {
|
||||||
|
@ -16,7 +16,7 @@ const bench = common.createBenchmark(main, {
|
|||||||
'deepEqual',
|
'deepEqual',
|
||||||
'notDeepEqual',
|
'notDeepEqual',
|
||||||
],
|
],
|
||||||
len: [1e2, 5e3]
|
len: [1e2, 5e3],
|
||||||
});
|
});
|
||||||
|
|
||||||
function main({ type, n, len, method, strict }) {
|
function main({ type, n, len, method, strict }) {
|
||||||
|
@ -3,9 +3,7 @@
|
|||||||
const common = require('../common.js');
|
const common = require('../common.js');
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
|
|
||||||
const bench = common.createBenchmark(main, {
|
const bench = common.createBenchmark(main, { n: [1e5] });
|
||||||
n: [1e5]
|
|
||||||
});
|
|
||||||
|
|
||||||
function main({ n }) {
|
function main({ n }) {
|
||||||
var i;
|
var i;
|
||||||
|
@ -5,11 +5,7 @@ const { throws, doesNotThrow } = require('assert');
|
|||||||
|
|
||||||
const bench = common.createBenchmark(main, {
|
const bench = common.createBenchmark(main, {
|
||||||
n: [1e4],
|
n: [1e4],
|
||||||
method: [
|
method: [ 'doesNotThrow', 'throws_TypeError', 'throws_RegExp' ],
|
||||||
'doesNotThrow',
|
|
||||||
'throws_TypeError',
|
|
||||||
'throws_RegExp'
|
|
||||||
]
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function main({ n, method }) {
|
function main({ n, method }) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user