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:
parent
92953fa194
commit
fa3149308e
@ -9,10 +9,7 @@ const bench = common.createBenchmark(main, {
|
|||||||
n: [25e6]
|
n: [25e6]
|
||||||
});
|
});
|
||||||
|
|
||||||
function main(conf) {
|
function main({ encoding, n }) {
|
||||||
const encoding = conf.encoding;
|
|
||||||
const n = conf.n | 0;
|
|
||||||
|
|
||||||
bench.start();
|
bench.start();
|
||||||
for (var i = 0; i < n; ++i) {
|
for (var i = 0; i < n; ++i) {
|
||||||
const sd = new StringDecoder(encoding);
|
const sd = new StringDecoder(encoding);
|
||||||
|
@ -4,8 +4,8 @@ const StringDecoder = require('string_decoder').StringDecoder;
|
|||||||
|
|
||||||
const bench = common.createBenchmark(main, {
|
const bench = common.createBenchmark(main, {
|
||||||
encoding: ['ascii', 'utf8', 'base64-utf8', 'base64-ascii', 'utf16le'],
|
encoding: ['ascii', 'utf8', 'base64-utf8', 'base64-ascii', 'utf16le'],
|
||||||
inlen: [32, 128, 1024, 4096],
|
inLen: [32, 128, 1024, 4096],
|
||||||
chunk: [16, 64, 256, 1024],
|
chunkLen: [16, 64, 256, 1024],
|
||||||
n: [25e5]
|
n: [25e5]
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -13,12 +13,7 @@ const UTF8_ALPHA = 'Blåbærsyltetøy';
|
|||||||
const ASC_ALPHA = 'Blueberry jam';
|
const ASC_ALPHA = 'Blueberry jam';
|
||||||
const UTF16_BUF = Buffer.from('Blåbærsyltetøy', 'utf16le');
|
const UTF16_BUF = Buffer.from('Blåbærsyltetøy', 'utf16le');
|
||||||
|
|
||||||
function main(conf) {
|
function main({ encoding, inLen, chunkLen, n }) {
|
||||||
const encoding = conf.encoding;
|
|
||||||
const inLen = conf.inlen | 0;
|
|
||||||
const chunkLen = conf.chunk | 0;
|
|
||||||
const n = conf.n | 0;
|
|
||||||
|
|
||||||
var alpha;
|
var alpha;
|
||||||
var buf;
|
var buf;
|
||||||
const chunks = [];
|
const chunks = [];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user