Skip to content

Commit

Permalink
benchmark: use consistent coding style in assert/*
Browse files Browse the repository at this point in the history
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: nodejs#25865
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Vse Mozhet Byt <[email protected]>
  • Loading branch information
Trott committed Feb 3, 2019
1 parent 4deb23a commit 3418956
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 31 deletions.
5 changes: 1 addition & 4 deletions benchmark/assert/deepequal-buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@ const bench = common.createBenchmark(main, {
n: [2e4],
len: [1e2, 1e3],
strict: [0, 1],
method: [
'deepEqual',
'notDeepEqual'
]
method: [ 'deepEqual', 'notDeepEqual' ],
});

function main({ len, n, method, strict }) {
Expand Down
4 changes: 2 additions & 2 deletions benchmark/assert/deepequal-map.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ const bench = common.createBenchmark(main, {
'deepEqual_mixed',
'notDeepEqual_primitiveOnly',
'notDeepEqual_objectOnly',
'notDeepEqual_mixed'
]
'notDeepEqual_mixed',
],
});

function benchmark(method, n, values, values2) {
Expand Down
9 changes: 3 additions & 6 deletions benchmark/assert/deepequal-object.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ const bench = common.createBenchmark(main, {
n: [5e3],
size: [1e2, 1e3, 5e4],
strict: [0, 1],
method: [
'deepEqual',
'notDeepEqual'
]
method: [ 'deepEqual', 'notDeepEqual' ],
});

function createObj(source, add = '') {
Expand All @@ -21,8 +18,8 @@ function createObj(source, add = '') {
a: [1, 2, 3],
baz: n,
c: {},
b: []
}
b: [],
},
}));
}

Expand Down
6 changes: 3 additions & 3 deletions benchmark/assert/deepequal-prims-and-objs-big-array-set.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const primValues = {
'string': 'a',
'number': 1,
'object': { 0: 'a' },
'array': [1, 2, 3]
'array': [1, 2, 3],
};

const bench = common.createBenchmark(main, {
Expand All @@ -20,8 +20,8 @@ const bench = common.createBenchmark(main, {
'deepEqual_Array',
'notDeepEqual_Array',
'deepEqual_Set',
'notDeepEqual_Set'
]
'notDeepEqual_Set',
],
});

function run(fn, n, actual, expected) {
Expand Down
7 changes: 2 additions & 5 deletions benchmark/assert/deepequal-prims-and-objs-big-loop.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,14 @@ const primValues = {
'string': 'a',
'number': 1,
'object': { 0: 'a' },
'array': [1, 2, 3]
'array': [1, 2, 3],
};

const bench = common.createBenchmark(main, {
primitive: Object.keys(primValues),
n: [2e4],
strict: [0, 1],
method: [
'deepEqual',
'notDeepEqual',
]
method: [ 'deepEqual', 'notDeepEqual' ],
});

function main({ n, primitive, method, strict }) {
Expand Down
4 changes: 2 additions & 2 deletions benchmark/assert/deepequal-set.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ const bench = common.createBenchmark(main, {
'deepEqual_mixed',
'notDeepEqual_primitiveOnly',
'notDeepEqual_objectOnly',
'notDeepEqual_mixed'
]
'notDeepEqual_mixed',
],
});

function benchmark(method, n, values, values2) {
Expand Down
2 changes: 1 addition & 1 deletion benchmark/assert/deepequal-typedarrays.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const bench = common.createBenchmark(main, {
'deepEqual',
'notDeepEqual',
],
len: [1e2, 5e3]
len: [1e2, 5e3],
});

function main({ type, n, len, method, strict }) {
Expand Down
4 changes: 1 addition & 3 deletions benchmark/assert/ok.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
const common = require('../common.js');
const assert = require('assert');

const bench = common.createBenchmark(main, {
n: [1e5]
});
const bench = common.createBenchmark(main, { n: [1e5] });

function main({ n }) {
var i;
Expand Down
6 changes: 1 addition & 5 deletions benchmark/assert/throws.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@ const { throws, doesNotThrow } = require('assert');

const bench = common.createBenchmark(main, {
n: [1e4],
method: [
'doesNotThrow',
'throws_TypeError',
'throws_RegExp'
]
method: [ 'doesNotThrow', 'throws_TypeError', 'throws_RegExp' ],
});

function main({ n, method }) {
Expand Down

0 comments on commit 3418956

Please sign in to comment.