summaryrefslogtreecommitdiff
path: root/benchmark/crypto
diff options
context:
space:
mode:
authorJames M Snell <jasnell@gmail.com>2016-06-08 08:18:26 -0700
committerJames M Snell <jasnell@gmail.com>2016-06-21 10:03:08 -0700
commit6be73feaeb31dbcc1547da648341c0b6f0d2d2bb (patch)
treea03e867b1d8f25af8183bd2741765c45d9a8db2b /benchmark/crypto
parent58a241d53790aee5dd6327543fc9849bd21fb9a7 (diff)
downloadandroid-node-v8-6be73feaeb31dbcc1547da648341c0b6f0d2d2bb.tar.gz
android-node-v8-6be73feaeb31dbcc1547da648341c0b6f0d2d2bb.tar.bz2
android-node-v8-6be73feaeb31dbcc1547da648341c0b6f0d2d2bb.zip
crypto,tls: perf improvements for crypto and tls getCiphers
Improve performance of crypto.getCiphers, getHashes, getCurves and tls.getCiphers by consolidating filterDuplicates logic, adding caching of output, and streamlining filterDuplicates implementation. Benchmarks: crypto.getCiphers n=1 v6.2.1 = 2559.3, new = 15890 ...... -83.89% crypto.getCiphers n=5000 v6.2.1 = 3516.3, new = 24203000 ... -99.99% tls.getCiphers n=1 v6.2.1 = 3405.3, new = 14877 ...... -77.11% tls.getCiphers n=5000 v6.2.1 = 6074.4, new = 24202000 ... -99.97% PR-URL: https://github.com/nodejs/node/pull/7225 Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com> Reviewed-By: Brian White <mscdex@mscdex.net>
Diffstat (limited to 'benchmark/crypto')
-rw-r--r--benchmark/crypto/get-ciphers.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/benchmark/crypto/get-ciphers.js b/benchmark/crypto/get-ciphers.js
new file mode 100644
index 0000000000..257c9af2fd
--- /dev/null
+++ b/benchmark/crypto/get-ciphers.js
@@ -0,0 +1,20 @@
+'use strict';
+
+const common = require('../common.js');
+
+const bench = common.createBenchmark(main, {
+ n: [1, 5000],
+ v: ['crypto', 'tls']
+});
+
+function main(conf) {
+ const n = +conf.n;
+ const v = conf.v;
+ const method = require(v).getCiphers;
+ var i = 0;
+
+ common.v8ForceOptimization(method);
+ bench.start();
+ for (; i < n; i++) method();
+ bench.end(n);
+}