Skip to content

Commit

Permalink
benchmark: use let instead of var in tls
Browse files Browse the repository at this point in the history
PR-URL: #31794
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
  • Loading branch information
dnlup authored and addaleax committed Mar 30, 2020
1 parent f172014 commit 108e91f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion benchmark/tls/convertprotocols.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const bench = common.createBenchmark(main, {

function main({ n }) {
const input = ['ABC', 'XYZ123', 'FOO'];
var m = {};
let m = {};
// First call dominates results
if (n > 1) {
tls.convertALPNProtocols(input, m);
Expand Down
10 changes: 5 additions & 5 deletions benchmark/tls/throughput.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ const bench = common.createBenchmark(main, {
});

const fixtures = require('../../test/common/fixtures');
var options;
let options;
const tls = require('tls');

function main({ dur, type, size }) {
var encoding;
var chunk;
let encoding;
let chunk;
switch (type) {
case 'buf':
chunk = Buffer.alloc(size, 'b');
Expand All @@ -37,7 +37,7 @@ function main({ dur, type, size }) {
};

const server = tls.createServer(options, onConnection);
var conn;
let conn;
server.listen(common.PORT, () => {
const opt = { port: common.PORT, rejectUnauthorized: false };
conn = tls.connect(opt, () => {
Expand All @@ -52,7 +52,7 @@ function main({ dur, type, size }) {
}
});

var received = 0;
let received = 0;
function onConnection(conn) {
conn.on('data', (chunk) => {
received += chunk.length;
Expand Down
10 changes: 5 additions & 5 deletions benchmark/tls/tls-connect.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ const bench = common.createBenchmark(main, {
dur: [5]
});

var clientConn = 0;
var serverConn = 0;
var dur;
var concurrency;
var running = true;
let clientConn = 0;
let serverConn = 0;
let dur;
let concurrency;
let running = true;

function main(conf) {
dur = conf.dur;
Expand Down

0 comments on commit 108e91f

Please sign in to comment.