-
Notifications
You must be signed in to change notification settings - Fork 848
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
479 additions
and
272 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
'use strict' | ||
|
||
const bench = require('fastbench') | ||
const pino = require('../../') | ||
|
||
const base = pino(pino.destination('/dev/null')) | ||
const baseCl = pino({ | ||
customLevels: {foo: 31} | ||
}, pino.destination('/dev/null')) | ||
const child = base.child({}) | ||
const childCl = base.child({ | ||
customLevels: {foo: 31} | ||
}) | ||
const childOfBaseCl = baseCl.child({}) | ||
|
||
const max = 100 | ||
|
||
const run = bench([ | ||
function benchPinoNoCustomLevel (cb) { | ||
for (var i = 0; i < max; i++) { | ||
base.info({ hello: 'world' }) | ||
} | ||
setImmediate(cb) | ||
}, | ||
function benchPinoCustomLevel (cb) { | ||
for (var i = 0; i < max; i++) { | ||
baseCl.foo({ hello: 'world' }) | ||
} | ||
setImmediate(cb) | ||
}, | ||
function benchChildNoCustomLevel (cb) { | ||
for (var i = 0; i < max; i++) { | ||
child.info({ hello: 'world' }) | ||
} | ||
setImmediate(cb) | ||
}, | ||
function benchPinoChildCustomLevel (cb) { | ||
for (var i = 0; i < max; i++) { | ||
childCl.foo({ hello: 'world' }) | ||
} | ||
setImmediate(cb) | ||
}, | ||
function benchPinoChildInheritedCustomLevel (cb) { | ||
for (var i = 0; i < max; i++) { | ||
childOfBaseCl.foo({ hello: 'world' }) | ||
} | ||
setImmediate(cb) | ||
} | ||
], 10000) | ||
|
||
run(run) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.