summaryrefslogtreecommitdiff
path: root/benchmark/zlib/pipe.js
diff options
context:
space:
mode:
Diffstat (limited to 'benchmark/zlib/pipe.js')
-rw-r--r--benchmark/zlib/pipe.js11
1 files changed, 7 insertions, 4 deletions
diff --git a/benchmark/zlib/pipe.js b/benchmark/zlib/pipe.js
index 9b05749bbb..6a1c427bc8 100644
--- a/benchmark/zlib/pipe.js
+++ b/benchmark/zlib/pipe.js
@@ -6,15 +6,18 @@ const zlib = require('zlib');
const bench = common.createBenchmark(main, {
inputLen: [1024],
duration: [5],
- type: ['string', 'buffer']
+ type: ['string', 'buffer'],
+ algorithm: ['gzip', 'brotli']
});
-function main({ inputLen, duration, type }) {
+function main({ inputLen, duration, type, algorithm }) {
const buffer = Buffer.alloc(inputLen, fs.readFileSync(__filename));
const chunk = type === 'buffer' ? buffer : buffer.toString('utf8');
- const input = zlib.createGzip();
- const output = zlib.createGunzip();
+ const input = algorithm === 'gzip' ?
+ zlib.createGzip() : zlib.createBrotliCompress();
+ const output = algorithm === 'gzip' ?
+ zlib.createGunzip() : zlib.createBrotliDecompress();
let readFromOutput = 0;
input.pipe(output);