Skip to content

Commit

Permalink
benchmark: (zlib) use destructuring
Browse files Browse the repository at this point in the history
PR-URL: nodejs#18250
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
BridgeAR authored and MayaLekova committed May 8, 2018
1 parent 9ace98c commit 4f77c42
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
7 changes: 3 additions & 4 deletions benchmark/zlib/creation.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@ const bench = common.createBenchmark(main, {
n: [5e5]
});

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

if (conf.options === 'true') {
if (options === 'true') {
const opts = {};
bench.start();
for (; i < n; ++i)
Expand Down
6 changes: 2 additions & 4 deletions benchmark/zlib/deflate.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@ const bench = common.createBenchmark(main, {
n: [4e5]
});

function main(conf) {
const n = +conf.n;
const method = conf.method;
const chunk = Buffer.alloc(+conf.inputLen, 'a');
function main({ n, method, inputLen }) {
const chunk = Buffer.alloc(inputLen, 'a');

var i = 0;
switch (method) {
Expand Down

0 comments on commit 4f77c42

Please sign in to comment.