mirror of
https://github.com/nodejs/node.git
synced 2025-04-29 22:40:57 +00:00

Each file should have a reasonable runtime while having a good accuracy. This adjust those up and down to have minimal runtimes with a good accuracy. PR-URL: https://github.com/nodejs/node/pull/57370 Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
38 lines
648 B
JavaScript
38 lines
648 B
JavaScript
'use strict';
|
|
const common = require('../common.js');
|
|
const assert = require('assert');
|
|
|
|
const bench = common.createBenchmark(main, {
|
|
n: [200],
|
|
size: [2, 75],
|
|
});
|
|
|
|
const baseObject = {
|
|
a: 1,
|
|
b: {
|
|
c: 2,
|
|
d: [3, 4, 5],
|
|
e: 'fghi',
|
|
j: {
|
|
k: 6,
|
|
},
|
|
},
|
|
};
|
|
|
|
function createObjects(size) {
|
|
return Array.from({ length: size }, () => baseObject);
|
|
}
|
|
|
|
function main({ n, size }) {
|
|
bench.start();
|
|
for (let i = 0; i < n; ++i) {
|
|
new assert.AssertionError({
|
|
actual: {},
|
|
expected: createObjects(size),
|
|
operator: 'partialDeepStrictEqual',
|
|
stackStartFunction: () => {},
|
|
});
|
|
}
|
|
bench.end(n);
|
|
}
|