diff options
author | Jackson Tian <shyvo1987@gmail.com> | 2015-11-22 17:08:45 +0800 |
---|---|---|
committer | James M Snell <jasnell@gmail.com> | 2015-12-30 11:54:26 -0800 |
commit | 3e740caaf368dbfcc8c59cc178258c4865af991c (patch) | |
tree | 8966bb837a1fd2bf6add34a7ebee6ef930550cde /benchmark/util | |
parent | 1de6e4f9abd1fcda9b40722d2803c906c259481a (diff) | |
download | android-node-v8-3e740caaf368dbfcc8c59cc178258c4865af991c.tar.gz android-node-v8-3e740caaf368dbfcc8c59cc178258c4865af991c.tar.bz2 android-node-v8-3e740caaf368dbfcc8c59cc178258c4865af991c.zip |
util: faster arrayToHash
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>
Diffstat (limited to 'benchmark/util')
-rw-r--r-- | benchmark/util/inspect.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/benchmark/util/inspect.js b/benchmark/util/inspect.js new file mode 100644 index 0000000000..8a59e6b48e --- /dev/null +++ b/benchmark/util/inspect.js @@ -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); +} |