Skip to content

Commit 5cd6f8a

Browse files
committed
benchmark: calibrate util.text-encoder
According to nodejs/performance#186 this benchmark takes 42 minutes to run a single run. So using calibrate-n script it suggests reduce it from 1e6 to 1e3 this should improve it.
1 parent bcb802c commit 5cd6f8a

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

benchmark/util/text-encoder.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ const common = require('../common.js');
44
const assert = require('assert');
55

66
const bench = common.createBenchmark(main, {
7-
len: [32, 256, 1024, 1024 * 8],
8-
n: [1e6],
7+
len: [32, 1024, 1024 * 8],
8+
n: [1000],
99
type: ['one-byte-string', 'two-byte-string', 'ascii'],
1010
op: ['encode', 'encodeInto'],
1111
});
@@ -31,8 +31,7 @@ function main({ n, op, len, type }) {
3131
const expected = encoder.encode(input);
3232
let result;
3333
bench.start();
34-
for (let i = 0; i < n; i++)
35-
result = encoder.encode(input);
34+
for (let i = 0; i < n; i++) result = encoder.encode(input);
3635
bench.end(n);
3736
assert.deepStrictEqual(result, expected);
3837
} else {
@@ -41,8 +40,7 @@ function main({ n, op, len, type }) {
4140
const expectedStats = encoder.encodeInto(input, expected);
4241
let result;
4342
bench.start();
44-
for (let i = 0; i < n; i++)
45-
result = encoder.encodeInto(input, subarray);
43+
for (let i = 0; i < n; i++) result = encoder.encodeInto(input, subarray);
4644
bench.end(n);
4745
assert.deepStrictEqual(subarray, expected);
4846
assert.deepStrictEqual(result, expectedStats);

0 commit comments

Comments
 (0)