summaryrefslogtreecommitdiff
path: root/benchmark
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2018-12-10 15:48:50 +0100
committerAnna Henningsen <anna@addaleax.net>2019-01-05 21:36:47 +0100
commitb7da5b79c300b2d5abf6658ba3fa8edf916f05cc (patch)
treeff29b5e91c7843edf163a15b47b8d99723902831 /benchmark
parent73753d48639200f79957b822599e9848b0ac942f (diff)
downloadandroid-node-v8-b7da5b79c300b2d5abf6658ba3fa8edf916f05cc.tar.gz
android-node-v8-b7da5b79c300b2d5abf6658ba3fa8edf916f05cc.tar.bz2
android-node-v8-b7da5b79c300b2d5abf6658ba3fa8edf916f05cc.zip
benchmark,test: add brotli
Co-authored-by: Hackzzila <admin@hackzzila.com> PR-URL: https://github.com/nodejs/node/pull/24938 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Jan Krems <jan.krems@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Myles Borins <myles.borins@gmail.com> Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Diffstat (limited to 'benchmark')
-rw-r--r--benchmark/zlib/creation.js3
-rw-r--r--benchmark/zlib/pipe.js11
2 files changed, 9 insertions, 5 deletions
diff --git a/benchmark/zlib/creation.js b/benchmark/zlib/creation.js
index 4984bf1a86..f23759fa0e 100644
--- a/benchmark/zlib/creation.js
+++ b/benchmark/zlib/creation.js
@@ -4,7 +4,8 @@ const zlib = require('zlib');
const bench = common.createBenchmark(main, {
type: [
- 'Deflate', 'DeflateRaw', 'Inflate', 'InflateRaw', 'Gzip', 'Gunzip', 'Unzip'
+ 'Deflate', 'DeflateRaw', 'Inflate', 'InflateRaw', 'Gzip', 'Gunzip', 'Unzip',
+ 'BrotliCompress', 'BrotliDecompress'
],
options: ['true', 'false'],
n: [5e5]
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);