diff options
author | Brian White <mscdex@mscdex.net> | 2020-06-21 11:54:24 -0400 |
---|---|---|
committer | James M Snell <jasnell@gmail.com> | 2020-06-23 17:08:13 -0700 |
commit | 336546b075edc068f7d8daf7c04d92a530d94ba4 (patch) | |
tree | 6e96d705d152eb2bb8c8e86527517f3c9a442fe9 /benchmark | |
parent | 4629e96c209bbc6e81a4ff178dcb8afa27feb042 (diff) | |
download | node-new-336546b075edc068f7d8daf7c04d92a530d94ba4.tar.gz |
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>
Diffstat (limited to 'benchmark')
-rw-r--r-- | benchmark/events/eventtarget.js | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/benchmark/events/eventtarget.js b/benchmark/events/eventtarget.js index 7a7253aefb..d2c3ad034f 100644 --- a/benchmark/events/eventtarget.js +++ b/benchmark/events/eventtarget.js @@ -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); |