Skip to content

Commit 625744d

Browse files
DiegoTUIBridgeAR
authored andcommitted
benchmark: add clear connections to secure-pair
adds clear connections to the secure-pair performance test to prove that in some cases (when the sender send the data in small chunks) clear connections perform worse than TLS connections Also add a byte chunk size test to benchmark/net/net-pipe.js Refs: #27970 PR-URL: #27971 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
1 parent 54c471a commit 625744d

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

‎benchmark/net/net-pipe.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const net = require('net');
66
constPORT=common.PORT;
77

88
constbench=common.createBenchmark(main,{
9-
len: [64,102400,1024*1024*16],
9+
len: [2,64,102400,1024*1024*16],
1010
type: ['utf','asc','buf'],
1111
dur: [5],
1212
});

‎benchmark/tls/secure-pair.js‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
constcommon=require('../common.js');
33
constbench=common.createBenchmark(main,{
44
dur: [5],
5-
securing: ['SecurePair','TLSSocket'],
6-
size: [2,1024,1024*1024]
5+
securing: ['SecurePair','TLSSocket','clear'],
6+
size: [2,100,1024,1024*1024]
77
});
88

99
constfixtures=require('../../test/common/fixtures');
@@ -37,7 +37,8 @@ function main({ dur, size, securing }) {
3737
isServer: false,
3838
rejectUnauthorized: false,
3939
};
40-
constconn=tls.connect(clientOptions,()=>{
40+
constnetwork=securing==='clear' ? net : tls;
41+
constconn=network.connect(clientOptions,()=>{
4142
setTimeout(()=>{
4243
constmbits=(received*8)/(1024*1024);
4344
bench.end(mbits);
@@ -69,6 +70,9 @@ function main({ dur, size, securing }) {
6970
case'TLSSocket':
7071
secureTLSSocket(conn,client);
7172
break;
73+
case'clear':
74+
conn.pipe(client);
75+
break;
7276
default:
7377
thrownewError('Invalid securing method');
7478
}

0 commit comments

Comments
 (0)