Skip to content

Commit 6591f5e

Browse files
committed
stream: fixup stream/iter FileHandle benchmarks
1 parent cc02896 commit 6591f5e

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

benchmark/fs/bench-filehandle-pipetosync.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
// Flags: --experimental-stream-iter
21
// Benchmark: pipeToSync with sync compression transforms.
32
// Measures fully synchronous file-to-file pipeline (no threadpool, no promises).
43
'use strict';
54

65
const common = require('../common.js');
76
const fs = require('fs');
8-
const { openSync, closeSync, writeSync, readFileSync, unlinkSync } = fs;
7+
const { openSync, closeSync, writeSync, unlinkSync } = fs;
98

109
const tmpdir = require('../../test/common/tmpdir');
1110
tmpdir.refresh();
@@ -16,6 +15,8 @@ const bench = common.createBenchmark(main, {
1615
compression: ['gzip', 'deflate', 'brotli', 'zstd'],
1716
filesize: [1024 * 1024, 16 * 1024 * 1024, 64 * 1024 * 1024],
1817
n: [5],
18+
}, {
19+
flags: ['--experimental-stream-iter'],
1920
});
2021

2122
function main({ compression, filesize, n }) {
@@ -93,9 +94,7 @@ function main({ compression, filesize, n }) {
9394
function runSync(srcFh, dstFh, upper, compressFactory, pipeToSync) {
9495
const w = dstFh.writer();
9596
pipeToSync(srcFh.pullSync(upper, compressFactory()), w);
96-
97-
// Read back compressed size
98-
return readFileSync(dstFile).length;
97+
return w.endSync();
9998
}
10099

101100
function cleanup() {

benchmark/fs/bench-filehandle-pull-vs-webstream.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// Flags: --experimental-stream-iter
21
// Compare FileHandle.createReadStream() vs readableWebStream() vs pull()
32
// reading a large file through two transforms: uppercase then compress.
43
'use strict';
@@ -18,6 +17,7 @@ const bench = common.createBenchmark(main, {
1817
filesize: [1024 * 1024, 16 * 1024 * 1024, 64 * 1024 * 1024],
1918
n: [5],
2019
}, {
20+
flags: ['--experimental-stream-iter'],
2121
// Classic and webstream only support gzip (native zlib / CompressionStream).
2222
// Brotli, deflate, zstd are pull-only via stream/iter transforms.
2323
combinationFilter({ api, compression }) {

0 commit comments

Comments
 (0)