mirror of
https://github.com/nodejs/node.git
synced 2025-12-28 07:50:41 +00:00
benchmark: fix EventTarget benchmark
Fixes: https://github.com/nodejs/node/issues/33782 PR-URL: https://github.com/nodejs/node/pull/34015 Reviewed-By: Denys Otrishko <shishugi@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
This commit is contained in:
parent
4629e96c20
commit
336546b075
@ -2,7 +2,7 @@
|
||||
const common = require('../common.js');
|
||||
|
||||
const bench = common.createBenchmark(main, {
|
||||
n: [2e7],
|
||||
n: [1e6],
|
||||
listeners: [1, 5, 10]
|
||||
}, { flags: ['--expose-internals'] });
|
||||
|
||||
@ -13,11 +13,9 @@ function main({ n, listeners }) {
|
||||
for (let n = 0; n < listeners; n++)
|
||||
target.addEventListener('foo', () => {});
|
||||
|
||||
const event = new Event('foo');
|
||||
|
||||
bench.start();
|
||||
for (let i = 0; i < n; i++) {
|
||||
target.dispatchEvent(event);
|
||||
target.dispatchEvent(new Event('foo'));
|
||||
}
|
||||
bench.end(n);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user