Welcome to mirror list, hosted at ThFree Co, Russian Federation.

convertprotocols.js « tls « benchmark - github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 87c447436a44dbf52bf135e46bb82869fc85dbde (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
'use strict';

const common = require('../common.js');
const tls = require('tls');

const bench = common.createBenchmark(main, {
  n: [1, 50000]
});

function main({ n }) {
  const input = ['ABC', 'XYZ123', 'FOO'];
  let m = {};
  // First call dominates results
  if (n > 1) {
    tls.convertALPNProtocols(input, m);
    m = {};
  }
  bench.start();
  for (let i = 0; i < n; i++)
    tls.convertALPNProtocols(input, m);
  bench.end(n);
}