summaryrefslogtreecommitdiff
path: root/benchmark/util/inspect-proxy.js
diff options
context:
space:
mode:
Diffstat (limited to 'benchmark/util/inspect-proxy.js')
-rw-r--r--benchmark/util/inspect-proxy.js18
1 files changed, 13 insertions, 5 deletions
diff --git a/benchmark/util/inspect-proxy.js b/benchmark/util/inspect-proxy.js
index dde86941ff..fd89d568ab 100644
--- a/benchmark/util/inspect-proxy.js
+++ b/benchmark/util/inspect-proxy.js
@@ -3,13 +3,21 @@
const util = require('util');
const common = require('../common.js');
-const bench = common.createBenchmark(main, { n: [2e4] });
+const bench = common.createBenchmark(main, {
+ n: [2e4],
+ showProxy: [0, 1],
+ isProxy: [0, 1]
+});
-function main({ n }) {
- const proxyA = new Proxy({}, { get: () => {} });
- const proxyB = new Proxy(() => {}, {});
+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: true });
+ util.inspect({ a: proxyA, b: proxyB }, { showProxy });
bench.end(n);
}