mirror of https://github.com/lukechilds/node.git
Browse Source
The `util.format()` is used frequently, make the method faster is better. R-URL: https://github.com/nodejs/node/pull/3964 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: James M Snell <jasnell@gmail.com>v5.x
Jackson Tian
9 years ago
committed by
Jeremiah Senkpiel
3 changed files with 21 additions and 2 deletions
@ -0,0 +1,15 @@ |
|||
var util = require('util'); |
|||
|
|||
var common = require('../common.js'); |
|||
|
|||
var bench = common.createBenchmark(main, {n: [5e6]}); |
|||
|
|||
function main(conf) { |
|||
var n = conf.n | 0; |
|||
|
|||
bench.start(); |
|||
for (var i = 0; i < n; i += 1) { |
|||
var r = util.inspect({a: 'a', b: 'b', c: 'c', d: 'd'}); |
|||
} |
|||
bench.end(n); |
|||
} |
Loading…
Reference in new issue