Skip to content

Commit 9b647a7

Browse files
committed
benchmark: calibrate util.format
According to nodejs/performance#186 this benchmark takes 2 minute to run a single run. So using calibrate-n script it suggests reduce it from 1e6 to 1e2
1 parent 5fffa8f commit 9b647a7

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

benchmark/util/format.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,28 @@ const util = require('util');
44
const common = require('../common');
55

66
const inputs = {
7-
'string': ['Hello, my name is %s', 'Fred'],
7+
string: ['Hello, my name is %s', 'Fred'],
88
'string-2': ['Hello, %s is my name', 'Fred'],
9-
'number': ['Hi, I was born in %d', 1989],
9+
number: ['Hi, I was born in %d', 1989],
1010
'replace-object': ['An error occurred %j', { msg: 'This is an error' }],
11-
'unknown': ['hello %a', 'test'],
11+
unknown: ['hello %a', 'test'],
1212
'no-replace': [1, 2],
1313
'no-replace-2': ['foobar', 'yeah', 'mensch', 5],
1414
'only-objects': [{ msg: 'This is an error' }, { msg: 'This is an error' }],
1515
'many-%': ['replace%%%%s%%%%many%s%s%s', 'percent'],
16-
'object-to-string': ['foo %s bar', { toString() { return 'bla'; } }],
16+
'object-to-string': [
17+
'foo %s bar',
18+
{
19+
toString() {
20+
return 'bla';
21+
},
22+
},
23+
],
1724
'object-%s': ['foo %s bar', { a: true, b: false }],
1825
};
1926

2027
const bench = common.createBenchmark(main, {
21-
n: [1e6],
28+
n: [100],
2229
type: Object.keys(inputs),
2330
});
2431

0 commit comments

Comments
 (0)