mirror of
https://github.com/nodejs/node.git
synced 2026-11-29 14:27:57 -05:00
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: https://github.com/nodejs/node/pull/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>
This commit is contained in:
1 parent
d36ae62bd7
commit
0e864a383c
1 file changed
+8
-3
@@ -20,8 +20,13 @@ function main({ n, sync }) {
|
||||
};
|
||||
|
||||
bench.start();
|
||||
for (var k = 0; k < n; ++k) {
|
||||
s.write(b);
|
||||
|
||||
let k = 0;
|
||||
function run() {
|
||||
while (k++ < n && s.write(b));
|
||||
if (k >= n)
|
||||
bench.end(n);
|
||||
}
|
||||
bench.end(n);
|
||||
s.on('drain', run);
|
||||
run();
|
||||
}
|
||||
Reference in new issue
Block a user