0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-30 15:30:56 +01:00
nodejs/benchmark/tls/convertprotocols.js
Bartosz Sosnowski ea61ce518b benchmark: remove forced optimization from tls
This removes all instances of %OptimizeFunctionOnNextCall from tls
benchmarks

PR-URL: https://github.com/nodejs/node/pull/9615
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2017-03-06 16:32:03 +01:00

24 lines
454 B
JavaScript

'use strict';
const common = require('../common.js');
const tls = require('tls');
const bench = common.createBenchmark(main, {
n: [1, 50000]
});
function main(conf) {
const n = +conf.n;
var i = 0;
var m = {};
// First call dominates results
if (n > 1) {
tls.convertNPNProtocols(['ABC', 'XYZ123', 'FOO'], m);
m = {};
}
bench.start();
for (; i < n; i++) tls.convertNPNProtocols(['ABC', 'XYZ123', 'FOO'], m);
bench.end(n);
}