summaryrefslogtreecommitdiff
path: root/benchmark/util/inspect-proxy.js
blob: 02379cdc770f3b5dabf99e43758ff16701a0bc2f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
'use strict';

const util = require('util');
const common = require('../common.js');

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

function main({ n, showProxy, isProxy }) {
  let proxyA = {};
  let proxyB = () => {};
  if (isProxy) {
    proxyA = new Proxy(proxyA, { get: () => {} });
    proxyB = new Proxy(proxyB, {});
  }
  bench.start();
  for (let i = 0; i < n; i += 1)
    util.inspect({ a: proxyA, b: proxyB }, { showProxy });
  bench.end(n);
}