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 1333798

Browse filesBrowse files
ronagtargos
authored andcommitted
benchmark: update manywrites back pressure
Make manywrites benchmark a bit more realistic by taking back pressure into account. Otherwise memory usage would no correspond well with real world usage. PR-URL: #30977 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
1 parent e6907f0 commit 1333798
Copy full SHA for 1333798

File tree

Expand file treeCollapse file tree

1 file changed

+8
-3
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+8
-3
lines changed
Open diff view settings
Collapse file

‎benchmark/streams/writable-manywrites.js‎

Copy file name to clipboardExpand all lines: benchmark/streams/writable-manywrites.js
+8-3Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,13 @@ function main({ n, sync }) {
2020
};
2121

2222
bench.start();
23-
for (var k = 0; k < n; ++k) {
24-
s.write(b);
23+
24+
let k = 0;
25+
function run() {
26+
while (k++ < n && s.write(b));
27+
if (k >= n)
28+
bench.end(n);
2529
}
26-
bench.end(n);
30+
s.on('drain', run);
31+
run();
2732
}

0 commit comments

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