Skip to content

Commit 4155712

Browse files
committed
fixup: test w/ callback
1 parent d1603cd commit 4155712

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

benchmark/streams/writable-manywrites.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,13 @@ const Writable = require('stream').Writable;
66
const bench = common.createBenchmark(main, {
77
n: [2e6],
88
sync: ['yes', 'no'],
9-
writev: ['yes', 'no']
9+
writev: ['yes', 'no'],
10+
callback: ['yes', 'no']
1011
});
1112

12-
function main({ n, sync, writev }) {
13+
function nop() {}
14+
15+
function main({ n, sync, writev, callback }) {
1316
const b = Buffer.allocUnsafe(1024);
1417
const s = new Writable();
1518
sync = sync === 'yes';
@@ -30,11 +33,13 @@ function main({ n, sync, writev }) {
3033
};
3134
}
3235

36+
const cb = callback === 'yes' ? nop : null;
37+
3338
bench.start();
3439

3540
let k = 0;
3641
function run() {
37-
while (k++ < n && s.write(b));
42+
while (k++ < n && s.write(b, cb));
3843
if (k >= n)
3944
bench.end(n);
4045
}

0 commit comments

Comments
 (0)