diff options
author | Brian White <mscdex@mscdex.net> | 2016-01-31 14:57:10 -0500 |
---|---|---|
committer | Brian White <mscdex@mscdex.net> | 2016-02-12 20:00:22 -0500 |
commit | 00638ac160c3b0564459162d847a518d9794cba0 (patch) | |
tree | 15456ad06af652b41fc2762f58ed9beec1455c3d /benchmark | |
parent | c8e650dee718420b430f8c68b0d6b31830e3184b (diff) | |
download | android-node-v8-00638ac160c3b0564459162d847a518d9794cba0.tar.gz android-node-v8-00638ac160c3b0564459162d847a518d9794cba0.tar.bz2 android-node-v8-00638ac160c3b0564459162d847a518d9794cba0.zip |
querystring: improve escape() performance
This commit improves escape() performance by up to 15% with the
existing querystring-stringify benchmarks by reducing the number
of string concatentations. A potential deopt is also avoided by
making sure the index passed to charCodeAt() is within bounds.
PR-URL: https://github.com/nodejs/node/pull/5012
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Diffstat (limited to 'benchmark')
-rw-r--r-- | benchmark/querystring/querystring-stringify.js | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/benchmark/querystring/querystring-stringify.js b/benchmark/querystring/querystring-stringify.js index d4bb95c21e..a22c3ea644 100644 --- a/benchmark/querystring/querystring-stringify.js +++ b/benchmark/querystring/querystring-stringify.js @@ -4,7 +4,7 @@ var v8 = require('v8'); var bench = common.createBenchmark(main, { type: ['noencode', 'encodemany', 'encodelast'], - n: [1e6], + n: [1e7], }); function main(conf) { @@ -37,6 +37,7 @@ function main(conf) { v8.setFlagsFromString('--allow_natives_syntax'); eval('%OptimizeFunctionOnNextCall(querystring.stringify)'); + querystring.stringify(input); bench.start(); for (var i = 0; i < n; i += 1) |