Skip to content

Commit 3e3254a

Browse files
BridgeARevanlucas
authored andcommitted
benchmark: (tls) use destructuring
PR-URL: #18250 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent c0707c5 commit 3e3254a

File tree

3 files changed

+5
-15
lines changed

3 files changed

+5
-15
lines changed

benchmark/tls/convertprotocols.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ const bench = common.createBenchmark(main, {
77
n: [1, 50000]
88
});
99

10-
function main(conf) {
11-
const n = +conf.n;
12-
10+
function main({ n }) {
1311
var i = 0;
1412
var m = {};
1513
// First call dominates results

benchmark/tls/throughput.js

+3-8
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,15 @@ const bench = common.createBenchmark(main, {
66
size: [2, 1024, 1024 * 1024]
77
});
88

9-
var dur, type, encoding, size;
10-
var server;
11-
129
const path = require('path');
1310
const fs = require('fs');
1411
const cert_dir = path.resolve(__dirname, '../../test/fixtures');
1512
var options;
1613
const tls = require('tls');
1714

18-
function main(conf) {
19-
dur = +conf.dur;
20-
type = conf.type;
21-
size = +conf.size;
22-
15+
function main({ dur, type, size }) {
16+
var encoding;
17+
var server;
2318
var chunk;
2419
switch (type) {
2520
case 'buf':

benchmark/tls/tls-connect.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@ var dur;
1616
var concurrency;
1717
var running = true;
1818

19-
function main(conf) {
20-
dur = +conf.dur;
21-
concurrency = +conf.concurrency;
22-
19+
function main({ dur, concurrency }) {
2320
const cert_dir = path.resolve(__dirname, '../../test/fixtures');
2421
const options = {
2522
key: fs.readFileSync(`${cert_dir}/test_key.pem`),

0 commit comments

Comments
 (0)