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
65const common = require ( '../common.js' ) ;
76const fs = require ( 'fs' ) ;
8- const { openSync, closeSync, writeSync, readFileSync , unlinkSync } = fs ;
7+ const { openSync, closeSync, writeSync, unlinkSync } = fs ;
98
109const tmpdir = require ( '../../test/common/tmpdir' ) ;
1110tmpdir . 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
2122function main ( { compression, filesize, n } ) {
@@ -93,9 +94,7 @@ function main({ compression, filesize, n }) {
9394function 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
101100function cleanup ( ) {
0 commit comments