Commit d13d900 1 parent 97e8820 commit d13d900 Copy full SHA for d13d900
File tree 4 files changed +16
-28
lines changed
4 files changed +16
-28
lines changed Original file line number Diff line number Diff line change @@ -9,9 +9,7 @@ const bench = common.createBenchmark(main, {
9
9
benchmarker : [ 'h2load' ]
10
10
} , { flags : [ '--no-warnings' , '--expose-http2' ] } ) ;
11
11
12
- function main ( conf ) {
13
- const n = + conf . n ;
14
- const nheaders = + conf . nheaders ;
12
+ function main ( { n, nheaders } ) {
15
13
const http2 = require ( 'http2' ) ;
16
14
const server = http2 . createServer ( {
17
15
maxHeaderListPairs : 20000
Original file line number Diff line number Diff line change @@ -14,15 +14,11 @@ const bench = common.createBenchmark(main, {
14
14
benchmarker : [ 'h2load' ]
15
15
} , { flags : [ '--no-warnings' , '--expose-http2' ] } ) ;
16
16
17
- function main ( conf ) {
18
-
17
+ function main ( { requests, streams, clients } ) {
19
18
fs . open ( file , 'r' , ( err , fd ) => {
20
19
if ( err )
21
20
throw err ;
22
21
23
- const n = + conf . requests ;
24
- const m = + conf . streams ;
25
- const c = + conf . clients ;
26
22
const http2 = require ( 'http2' ) ;
27
23
const server = http2 . createServer ( ) ;
28
24
server . on ( 'stream' , ( stream ) => {
@@ -32,10 +28,10 @@ function main(conf) {
32
28
server . listen ( PORT , ( ) => {
33
29
bench . http ( {
34
30
path : '/' ,
35
- requests : n ,
36
- maxConcurrentStreams : m ,
37
- clients : c ,
38
- threads : c
31
+ requests,
32
+ maxConcurrentStreams : streams ,
33
+ clients,
34
+ threads : clients
39
35
} , ( ) => server . close ( ) ) ;
40
36
} ) ;
41
37
Original file line number Diff line number Diff line change @@ -15,10 +15,7 @@ const bench = common.createBenchmark(main, {
15
15
benchmarker : [ 'h2load' ]
16
16
} , { flags : [ '--no-warnings' , '--expose-http2' ] } ) ;
17
17
18
- function main ( conf ) {
19
- const n = + conf . requests ;
20
- const m = + conf . streams ;
21
- const c = + conf . clients ;
18
+ function main ( { requests, streams, clients } ) {
22
19
const http2 = require ( 'http2' ) ;
23
20
const server = http2 . createServer ( ) ;
24
21
server . on ( 'stream' , ( stream ) => {
@@ -30,10 +27,10 @@ function main(conf) {
30
27
server . listen ( PORT , ( ) => {
31
28
bench . http ( {
32
29
path : '/' ,
33
- requests : n ,
34
- maxConcurrentStreams : m ,
35
- clients : c ,
36
- threads : c
30
+ requests,
31
+ maxConcurrentStreams : streams ,
32
+ clients,
33
+ threads : clients
37
34
} , ( ) => { server . close ( ) ; } ) ;
38
35
} ) ;
39
36
}
Original file line number Diff line number Diff line change @@ -10,19 +10,16 @@ const bench = common.createBenchmark(main, {
10
10
benchmarker : [ 'h2load' ]
11
11
} , { flags : [ '--no-warnings' , '--expose-http2' ] } ) ;
12
12
13
- function main ( conf ) {
14
- const m = + conf . streams ;
15
- const l = + conf . length ;
16
- const s = + conf . size ;
13
+ function main ( { streams, length, size } ) {
17
14
const http2 = require ( 'http2' ) ;
18
15
const server = http2 . createServer ( ) ;
19
16
server . on ( 'stream' , ( stream ) => {
20
17
stream . respond ( ) ;
21
18
let written = 0 ;
22
19
function write ( ) {
23
- stream . write ( 'ü' . repeat ( s ) ) ;
24
- written += s ;
25
- if ( written < l )
20
+ stream . write ( 'ü' . repeat ( size ) ) ;
21
+ written += size ;
22
+ if ( written < length )
26
23
setImmediate ( write ) ;
27
24
else
28
25
stream . end ( ) ;
@@ -33,7 +30,7 @@ function main(conf) {
33
30
bench . http ( {
34
31
path : '/' ,
35
32
requests : 10000 ,
36
- maxConcurrentStreams : m ,
33
+ maxConcurrentStreams : streams ,
37
34
} , ( ) => { server . close ( ) ; } ) ;
38
35
} ) ;
39
36
}
You can’t perform that action at this time.
0 commit comments