From 97e882061d5c6aafa425f44d1859ad5ab56d7ee2 Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Sat, 30 Dec 2017 03:57:10 +0100 Subject: [PATCH] benchmark: (string_decoder) use destructuring PR-URL: https://github.com/nodejs/node/pull/18250 Reviewed-By: Matteo Collina Reviewed-By: James M Snell --- benchmark/string_decoder/string-decoder-create.js | 5 +---- benchmark/string_decoder/string-decoder.js | 11 +++-------- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/benchmark/string_decoder/string-decoder-create.js b/benchmark/string_decoder/string-decoder-create.js index 17c0f6750d0721..386f99e7c0ee6f 100644 --- a/benchmark/string_decoder/string-decoder-create.js +++ b/benchmark/string_decoder/string-decoder-create.js @@ -9,10 +9,7 @@ const bench = common.createBenchmark(main, { n: [25e6] }); -function main(conf) { - const encoding = conf.encoding; - const n = conf.n | 0; - +function main({ encoding, n }) { bench.start(); for (var i = 0; i < n; ++i) { const sd = new StringDecoder(encoding); diff --git a/benchmark/string_decoder/string-decoder.js b/benchmark/string_decoder/string-decoder.js index 31cf7bf2f0a8a5..95baa893bbbf94 100644 --- a/benchmark/string_decoder/string-decoder.js +++ b/benchmark/string_decoder/string-decoder.js @@ -4,8 +4,8 @@ const StringDecoder = require('string_decoder').StringDecoder; const bench = common.createBenchmark(main, { encoding: ['ascii', 'utf8', 'base64-utf8', 'base64-ascii', 'utf16le'], - inlen: [32, 128, 1024, 4096], - chunk: [16, 64, 256, 1024], + inLen: [32, 128, 1024, 4096], + chunkLen: [16, 64, 256, 1024], n: [25e5] }); @@ -13,12 +13,7 @@ const UTF8_ALPHA = 'Blåbærsyltetøy'; const ASC_ALPHA = 'Blueberry jam'; const UTF16_BUF = Buffer.from('Blåbærsyltetøy', 'utf16le'); -function main(conf) { - const encoding = conf.encoding; - const inLen = conf.inlen | 0; - const chunkLen = conf.chunk | 0; - const n = conf.n | 0; - +function main({ encoding, inLen, chunkLen, n }) { var alpha; var buf; const chunks = [];