Skip to content
Permalink
Browse files

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>
  • Loading branch information
ronag authored and Trott committed Dec 15, 2019
1 parent ec4bf4a commit ea86f8c902e13d8cff0e01007ed0d978f59fe132
Showing with 8 additions and 3 deletions.
  1. +8 −3 benchmark/streams/writable-manywrites.js
@@ -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();
}

0 comments on commit ea86f8c

Please sign in to comment.
You can’t perform that action at this time.