benchmark: (string_decoder) use destructuring

PR-URL: https://github.com/nodejs/node/pull/18250
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Ruben Bridgewater 2017-12-30 03:57:10 +01:00
parent 92953fa194
commit fa3149308e
No known key found for this signature in database
GPG Key ID: F07496B3EB3C1762
2 changed files with 4 additions and 12 deletions

View File

@ -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);

View File

@ -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 = [];