Skip to content

Commit 76f671b

Browse files
BridgeARevanlucas
authored andcommitted
benchmark: (zlib) use destructuring
PR-URL: #18250 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent aa47fe0 commit 76f671b

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

benchmark/zlib/creation.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,13 @@ const bench = common.createBenchmark(main, {
1010
n: [5e5]
1111
});
1212

13-
function main(conf) {
14-
const n = +conf.n;
15-
const fn = zlib[`create${conf.type}`];
13+
function main({ n, type, options }) {
14+
const fn = zlib[`create${type}`];
1615
if (typeof fn !== 'function')
1716
throw new Error('Invalid zlib type');
1817
var i = 0;
1918

20-
if (conf.options === 'true') {
19+
if (options === 'true') {
2120
const opts = {};
2221
bench.start();
2322
for (; i < n; ++i)

benchmark/zlib/deflate.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,8 @@ const bench = common.createBenchmark(main, {
88
n: [4e5]
99
});
1010

11-
function main(conf) {
12-
const n = +conf.n;
13-
const method = conf.method;
14-
const chunk = Buffer.alloc(+conf.inputLen, 'a');
11+
function main({ n, method, inputLen }) {
12+
const chunk = Buffer.alloc(inputLen, 'a');
1513

1614
var i = 0;
1715
switch (method) {

0 commit comments

Comments
 (0)