1'use strict'; 2 3const common = require('../common.js'); 4const tls = require('tls'); 5 6const bench = common.createBenchmark(main, { 7 n: [1, 50000] 8}); 9 10function main({ n }) { 11 const input = ['ABC', 'XYZ123', 'FOO']; 12 let m = {}; 13 // First call dominates results 14 if (n > 1) { 15 tls.convertALPNProtocols(input, m); 16 m = {}; 17 } 18 bench.start(); 19 for (let i = 0; i < n; i++) 20 tls.convertALPNProtocols(input, m); 21 bench.end(n); 22} 23