summaryrefslogtreecommitdiff
path: root/benchmark/process/next-tick-exec-args.js
diff options
context:
space:
mode:
authorAnatoli Papirovski <apapirovski@mac.com>2018-05-02 10:17:23 +0200
committerAnatoli Papirovski <apapirovski@mac.com>2018-05-06 07:29:47 +0200
commit34bd9f318a164d6b2ee949793146b85b3e152d5f (patch)
tree7193c063b4f9424c3158984f8bdc47c97c5d12f7 /benchmark/process/next-tick-exec-args.js
parent491ae12e412076ac9360d34516c827e941caed12 (diff)
downloadandroid-node-v8-34bd9f318a164d6b2ee949793146b85b3e152d5f.tar.gz
android-node-v8-34bd9f318a164d6b2ee949793146b85b3e152d5f.tar.bz2
android-node-v8-34bd9f318a164d6b2ee949793146b85b3e152d5f.zip
benchmark: track exec time in next-tick-exec
The next-tick-exec benchmarks were meant to track nextTick execution time but due to an error, they actually track addition and execution. PR-URL: https://github.com/nodejs/node/pull/20462 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'benchmark/process/next-tick-exec-args.js')
-rw-r--r--benchmark/process/next-tick-exec-args.js11
1 files changed, 6 insertions, 5 deletions
diff --git a/benchmark/process/next-tick-exec-args.js b/benchmark/process/next-tick-exec-args.js
index 3be86cc08e..f5d0fb9422 100644
--- a/benchmark/process/next-tick-exec-args.js
+++ b/benchmark/process/next-tick-exec-args.js
@@ -5,8 +5,11 @@ const bench = common.createBenchmark(main, {
});
function main({ n }) {
+ function onNextTick(i) {
+ if (i + 1 === n)
+ bench.end(n);
+ }
- bench.start();
for (var i = 0; i < n; i++) {
if (i % 4 === 0)
process.nextTick(onNextTick, i, true, 10, 'test');
@@ -17,8 +20,6 @@ function main({ n }) {
else
process.nextTick(onNextTick, i);
}
- function onNextTick(i) {
- if (i + 1 === n)
- bench.end(n);
- }
+
+ bench.start();
}