mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 13:48:44 +02:00
benchmark: adjust configuration for string-decoder bench
According to https://github.com/nodejs/node/pull/59186 this benchmark file takes 6 hours to complete a full benchmark/compare.js script (60 runs in total) and this regression tests unrealitics to do between Node.js releases. By using calibrate-n scripts I could find a better N also ajusting some bench configs. e.g: avoid dead code elimination by V8. PR-URL: https://github.com/nodejs/node/pull/59187 Refs: https://github.com/nodejs/node/pull/59186 Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
parent
345a550fa1
commit
daa9e4bb8e
1 changed files with 7 additions and 3 deletions
|
@ -1,11 +1,12 @@
|
|||
'use strict';
|
||||
const common = require('../common.js');
|
||||
const StringDecoder = require('string_decoder').StringDecoder;
|
||||
const assert = require('node:assert');
|
||||
|
||||
const bench = common.createBenchmark(main, {
|
||||
encoding: ['ascii', 'utf8', 'base64-utf8', 'base64-ascii', 'utf16le'],
|
||||
inLen: [32, 128, 1024, 4096],
|
||||
chunkLen: [16, 64, 256, 1024],
|
||||
inLen: [32, 128, 1024],
|
||||
chunkLen: [16, 256, 1024],
|
||||
n: [25e5],
|
||||
});
|
||||
|
||||
|
@ -75,10 +76,13 @@ function main({ encoding, inLen, chunkLen, n }) {
|
|||
|
||||
const nChunks = chunks.length;
|
||||
|
||||
let avoidDeadCode;
|
||||
bench.start();
|
||||
for (let i = 0; i < n; ++i) {
|
||||
avoidDeadCode = '';
|
||||
for (let j = 0; j < nChunks; ++j)
|
||||
sd.write(chunks[j]);
|
||||
avoidDeadCode += sd.write(chunks[j]);
|
||||
}
|
||||
bench.end(n);
|
||||
assert.ok(avoidDeadCode);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue