Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 55af327

Browse filesBrowse files
apapirovskiMylesBorins
authored andcommitted
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: #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>
1 parent cfb2f34 commit 55af327
Copy full SHA for 55af327

File tree

Expand file treeCollapse file tree

2 files changed

+12
-10
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+12
-10
lines changed
Open diff view settings
Collapse file

‎benchmark/process/next-tick-exec-args.js‎

Copy file name to clipboardExpand all lines: benchmark/process/next-tick-exec-args.js
+6-5Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@ const bench = common.createBenchmark(main, {
55
});
66

77
function main({ n }) {
8+
function onNextTick(i) {
9+
if (i + 1 === n)
10+
bench.end(n);
11+
}
812

9-
bench.start();
1013
for (var i = 0; i < n; i++) {
1114
if (i % 4 === 0)
1215
process.nextTick(onNextTick, i, true, 10, 'test');
@@ -17,8 +20,6 @@ function main({ n }) {
1720
else
1821
process.nextTick(onNextTick, i);
1922
}
20-
function onNextTick(i) {
21-
if (i + 1 === n)
22-
bench.end(n);
23-
}
23+
24+
bench.start();
2425
}
Collapse file

‎benchmark/process/next-tick-exec.js‎

Copy file name to clipboardExpand all lines: benchmark/process/next-tick-exec.js
+6-5Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@ const bench = common.createBenchmark(main, {
55
});
66

77
function main({ n }) {
8-
9-
bench.start();
10-
for (var i = 0; i < n; i++) {
11-
process.nextTick(onNextTick, i);
12-
}
138
function onNextTick(i) {
149
if (i + 1 === n)
1510
bench.end(n);
1611
}
12+
13+
for (var i = 0; i < n; i++) {
14+
process.nextTick(onNextTick, i);
15+
}
16+
17+
bench.start();
1718
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.