summaryrefslogtreecommitdiff
path: root/benchmark/assert/deepequal-prims-and-objs-big-loop.js
blob: dea084bc984126d44f7c76688a9331566ac06cf8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
'use strict';
var common = require('../common.js');
var assert = require('assert');

const primValues = {
  'null': null,
  'undefined': undefined,
  'string': 'a',
  'number': 1,
  'boolean': true,
  'object': { 0: 'a' },
  'array': [1, 2, 3],
  'new-array': new Array([1, 2, 3])
};

var bench = common.createBenchmark(main, {
  prim: Object.keys(primValues),
  n: [1e5]
});

function main(conf) {
  var prim = primValues[conf.prim];
  var n = +conf.n;
  var x;

  bench.start();

  for (x = 0; x < n; x++) {
    // eslint-disable-next-line no-restricted-properties
    assert.deepEqual(new Array([prim]), new Array([prim]));
  }

  bench.end(n);
}