0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-30 23:43:09 +01:00
nodejs/benchmark/crypto/get-ciphers.js
Bartosz Sosnowski 6df23fa39f benchmark: fix punycode and get-ciphers benchmark
Add missing 'i=0' from for-loops from punycode and get-ciphers
benchmarks.

PR-URL: https://github.com/nodejs/node/pull/11720
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2017-03-09 22:01:45 +01:00

24 lines
446 B
JavaScript

'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;
// first call to getChipers will dominate the results
if (n > 1) {
for (; i < n; i++)
method();
}
bench.start();
for (i = 0; i < n; i++) method();
bench.end(n);
}