summaryrefslogtreecommitdiff
path: root/benchmark/assert/deepequal-typedarrays.js
diff options
context:
space:
mode:
Diffstat (limited to 'benchmark/assert/deepequal-typedarrays.js')
-rw-r--r--benchmark/assert/deepequal-typedarrays.js20
1 files changed, 10 insertions, 10 deletions
diff --git a/benchmark/assert/deepequal-typedarrays.js b/benchmark/assert/deepequal-typedarrays.js
index c4d8f434bf..9f9c68a673 100644
--- a/benchmark/assert/deepequal-typedarrays.js
+++ b/benchmark/assert/deepequal-typedarrays.js
@@ -6,39 +6,39 @@ const bench = common.createBenchmark(main, {
type: [
'Int8Array',
'Uint8Array',
- 'Int16Array',
- 'Uint16Array',
- 'Int32Array',
- 'Uint32Array',
'Float32Array',
'Float64Array',
'Uint8ClampedArray',
],
- n: [1],
+ n: [5e2],
+ strict: [0, 1],
method: [
'deepEqual',
- 'deepStrictEqual',
'notDeepEqual',
- 'notDeepStrictEqual'
],
- len: [1e6]
+ len: [1e2, 5e3]
});
-function main({ type, n, len, method }) {
+function main({ type, n, len, method, strict }) {
if (!method)
method = 'deepEqual';
const clazz = global[type];
const actual = new clazz(len);
const expected = new clazz(len);
- const expectedWrong = Buffer.alloc(len);
+ const expectedWrong = new clazz(len);
const wrongIndex = Math.floor(len / 2);
expectedWrong[wrongIndex] = 123;
+ if (strict) {
+ method = method.replace('eep', 'eepStrict');
+ }
const fn = assert[method];
const value2 = method.includes('not') ? expectedWrong : expected;
bench.start();
for (var i = 0; i < n; ++i) {
+ actual[0] = i;
+ value2[0] = i;
fn(actual, value2);
}
bench.end(n);