-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathformat-s.bench.js
More file actions
44 lines (39 loc) · 1.02 KB
/
format-s.bench.js
File metadata and controls
44 lines (39 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
const bench = require('fastbench')
const max = JSON.parse(process.env.MAX || 10000)
const stream = max === 1 ? process.stderr : undefined
const { bunyan, debug, pino, pinoAsync, debugLevel, debugLevelAsync } =
require('./instances.js')(stream)
const run = bench(
[
function benchDebug(done) {
debug('hello %s', 'world')
process.nextTick(done)
},
function benchBunyan(done) {
bunyan.debug('hello %s', 'world')
process.nextTick(done)
},
function benchPino(done) {
pino.debug('hello %s', 'world')
process.nextTick(done)
},
function benchDebugLevel(done) {
debugLevel.debug('hello %s', 'world')
process.nextTick(done)
},
function benchPinoAsync(done) {
pinoAsync.debug('hello %s', 'world')
process.nextTick(done)
},
function benchDebugLevelAsync(done) {
debugLevelAsync.debug('hello %s', 'world')
process.nextTick(done)
}
],
max
)
const final = () => {
pinoAsync.flush()
debugLevelAsync.flush()
}
run(final)