FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

benchmark: apply `highWaterMark` in webstreams `pipe-to` · nodejs/node@562168f · GitHub

/ node Public

Commit 562168f

Browse files
authored andcommitted
benchmark: apply highWaterMark in webstreams pipe-to
The highWaterMark values were passed as properties of the underlying source and sink dictionaries, where they are ignored: a queuing strategy's highWaterMark is read from the constructors' second argument. Every configuration therefore measured the identical workload at the default highWaterMark of 1, which also explains the historically high run-to-run variance of this benchmark family. Pass the strategies as the constructors' second argument and cover the default (1) alongside buffered (1024, 4096) configurations. Signed-off-by: Matteo Collina <hello@matteocollina.com> PR-URL: #65138 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent 5edffb5 commit 562168f

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

‎benchmark/webstreams/pipe-to.js‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,27 @@ const {
77

88
const bench = common.createBenchmark(main, {
99
n: [5e5],
10-
highWaterMarkR: [512, 1024, 2048, 4096],
11-
highWaterMarkW: [512, 1024, 2048, 4096],
10+
highWaterMarkR: [1, 1024, 4096],
11+
highWaterMarkW: [1, 1024, 4096],
1212
});
1313

1414

1515
async function main({ n, highWaterMarkR, highWaterMarkW }) {
1616
const b = Buffer.alloc(1024);
1717
let i = 0;
1818
const rs = new ReadableStream({
19-
highWaterMark: highWaterMarkR,
2019
pull: function(controller) {
2120
if (i++ < n) {
2221
controller.enqueue(b);
2322
} else {
2423
controller.close();
2524
}
2625
},
27-
});
26+
}, { highWaterMark: highWaterMarkR });
2827
const ws = new WritableStream({
29-
highWaterMark: highWaterMarkW,
3028
write(chunk, controller) {},
3129
close() { bench.end(n); },
32-
});
30+
}, { highWaterMark: highWaterMarkW });
3331

3432
bench.start();
3533
rs.pipeTo(ws);

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL