• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2
3const common = require('../common.js');
4const assert = require('node:assert');
5
6const bench = common.createBenchmark(main, {
7  n: [1e6],
8}, { flags: ['--expose-internals'] });
9
10function main({ n }) {
11  const { EventTarget } = require('internal/event_target');
12
13  let target;
14
15  bench.start();
16  for (let i = 0; i < n; i++) {
17    target = new EventTarget();
18  }
19  bench.end(n);
20
21  // Avoid V8 deadcode (elimination)
22  assert.ok(target);
23}
24