mirror of
https://github.com/nodejs/node.git
synced 2024-11-22 07:37:56 +01:00
b5fe45fb9a
PR-URL: https://github.com/nodejs/node/pull/47774 Reviewed-By: Debadree Chatterjee <debadree333@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
24 lines
453 B
JavaScript
24 lines
453 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common.js');
|
|
const assert = require('node:assert');
|
|
|
|
const bench = common.createBenchmark(main, {
|
|
n: [1e6],
|
|
}, { flags: ['--expose-internals'] });
|
|
|
|
function main({ n }) {
|
|
const { EventTarget } = require('internal/event_target');
|
|
|
|
let target;
|
|
|
|
bench.start();
|
|
for (let i = 0; i < n; i++) {
|
|
target = new EventTarget();
|
|
}
|
|
bench.end(n);
|
|
|
|
// Avoid V8 deadcode (elimination)
|
|
assert.ok(target);
|
|
}
|