benchmark: adjust configuration for string-decoder bench · nodejs/node@5457c7a
11'use strict';
22const common = require('../common.js');
33const StringDecoder = require('string_decoder').StringDecoder;
4+const assert = require('node:assert');
4556const bench = common.createBenchmark(main, {
67encoding: ['ascii', 'utf8', 'base64-utf8', 'base64-ascii', 'utf16le'],
7-inLen: [32, 128, 1024, 4096],
8-chunkLen: [16, 64, 256, 1024],
8+inLen: [32, 128, 1024],
9+chunkLen: [16, 256, 1024],
910n: [25e5],
1011});
1112@@ -75,10 +76,13 @@ function main({ encoding, inLen, chunkLen, n }) {
75767677const nChunks = chunks.length;
777879+let avoidDeadCode;
7880bench.start();
7981for (let i = 0; i < n; ++i) {
82+avoidDeadCode = '';
8083for (let j = 0; j < nChunks; ++j)
81-sd.write(chunks[j]);
84+avoidDeadCode += sd.write(chunks[j]);
8285}
8386bench.end(n);
87+assert.ok(avoidDeadCode);
8488}