diff options
author | Benedikt Meurer <bmeurer@google.com> | 2017-07-03 12:52:37 +0300 |
---|---|---|
committer | Matteo Collina <hello@matteocollina.com> | 2017-07-05 14:14:13 +0300 |
commit | 0011eb28cf56deedba9c3e61865554aa19a63b9e (patch) | |
tree | b77144baf699fd0f2a8f97d2f2973f4a65d00854 /benchmark/events/ee-once.js | |
parent | 6e86a70da2f54bd68cc5a8038a5d6940d6a4fce9 (diff) |
benchmark: Improve event performance tests.
Currently most of the event tests only test a single event type,
which might let those benchmark take fast-paths (in V8) that aren't
taken in realistic use cases, and thus the benchmarks are not good
proxies of real world uses.
PR-URL: https://github.com/nodejs/node/pull/14052
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
Diffstat (limited to 'benchmark/events/ee-once.js')
-rw-r--r-- | benchmark/events/ee-once.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/benchmark/events/ee-once.js b/benchmark/events/ee-once.js index 29ea562c406..56f7fb9e7c3 100644 --- a/benchmark/events/ee-once.js +++ b/benchmark/events/ee-once.js @@ -13,8 +13,9 @@ function main(conf) { bench.start(); for (var i = 0; i < n; i += 1) { - ee.once('dummy', listener); - ee.emit('dummy'); + var dummy = (i % 2 === 0) ? 'dummy0' : 'dummy1'; + ee.once(dummy, listener); + ee.emit(dummy); } bench.end(n); } |