Skip to content

Commit 97e8820

Browse files
BridgeARevanlucas
authored andcommitted
benchmark: (string_decoder) use destructuring
PR-URL: #18250 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 5b0e3b9 commit 97e8820

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

benchmark/string_decoder/string-decoder-create.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@ const bench = common.createBenchmark(main, {
99
n: [25e6]
1010
});
1111

12-
function main(conf) {
13-
const encoding = conf.encoding;
14-
const n = conf.n | 0;
15-
12+
function main({ encoding, n }) {
1613
bench.start();
1714
for (var i = 0; i < n; ++i) {
1815
const sd = new StringDecoder(encoding);

benchmark/string_decoder/string-decoder.js

+3-8
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,16 @@ const StringDecoder = require('string_decoder').StringDecoder;
44

55
const bench = common.createBenchmark(main, {
66
encoding: ['ascii', 'utf8', 'base64-utf8', 'base64-ascii', 'utf16le'],
7-
inlen: [32, 128, 1024, 4096],
8-
chunk: [16, 64, 256, 1024],
7+
inLen: [32, 128, 1024, 4096],
8+
chunkLen: [16, 64, 256, 1024],
99
n: [25e5]
1010
});
1111

1212
const UTF8_ALPHA = 'Blåbærsyltetøy';
1313
const ASC_ALPHA = 'Blueberry jam';
1414
const UTF16_BUF = Buffer.from('Blåbærsyltetøy', 'utf16le');
1515

16-
function main(conf) {
17-
const encoding = conf.encoding;
18-
const inLen = conf.inlen | 0;
19-
const chunkLen = conf.chunk | 0;
20-
const n = conf.n | 0;
21-
16+
function main({ encoding, inLen, chunkLen, n }) {
2217
var alpha;
2318
var buf;
2419
const chunks = [];

0 commit comments

Comments
 (0)