File tree Expand file tree Collapse file tree 3 files changed +19
-4
lines changed
src/Servers/Kestrel/perf/Kestrel.Performance Expand file tree Collapse file tree 3 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -40,7 +40,6 @@ public abstract class Http2ConnectionBenchmarkBase
40
40
41
41
protected abstract Task ProcessRequest ( HttpContext httpContext ) ;
42
42
43
- [ GlobalSetup ]
44
43
public virtual void GlobalSetup ( )
45
44
{
46
45
_memoryPool = SlabMemoryPoolFactory . Create ( ) ;
Original file line number Diff line number Diff line change @@ -14,8 +14,10 @@ public class Http2ConnectionBenchmark : Http2ConnectionBenchmarkBase
14
14
15
15
private string _responseData ;
16
16
17
+ [ GlobalSetup ]
17
18
public override void GlobalSetup ( )
18
19
{
20
+ base . GlobalSetup ( ) ;
19
21
_responseData = new string ( '!' , ResponseDataLength ) ;
20
22
}
21
23
Original file line number Diff line number Diff line change @@ -10,18 +10,32 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Performance
10
10
public class Http2ConnectionHeadersBenchmark : Http2ConnectionBenchmarkBase
11
11
{
12
12
[ Params ( 1 , 4 , 32 ) ]
13
- public int CustomHeaders { get ; set ; }
13
+ public int HeadersCount { get ; set ; }
14
14
15
15
[ Params ( true , false ) ]
16
16
public bool HeadersChange { get ; set ; }
17
17
18
18
private int _headerIndex ;
19
+ private string [ ] _headerNames ;
20
+
21
+ [ GlobalSetup ]
22
+ public override void GlobalSetup ( )
23
+ {
24
+ base . GlobalSetup ( ) ;
25
+
26
+ _headerNames = new string [ HeadersCount * ( HeadersChange ? 1000 : 1 ) ] ;
27
+ for ( var i = 0 ; i < _headerNames . Length ; i ++ )
28
+ {
29
+ _headerNames [ i ] = "CustomHeader" + i ;
30
+ }
31
+ }
19
32
20
33
protected override Task ProcessRequest ( HttpContext httpContext )
21
34
{
22
- for ( var i = 0 ; i < CustomHeaders ; i ++ )
35
+ for ( var i = 0 ; i < HeadersCount ; i ++ )
23
36
{
24
- httpContext . Response . Headers [ "CustomHeader" + _headerIndex ] = "The quick brown fox jumps over the lazy dog." ;
37
+ var headerName = _headerNames [ _headerIndex % HeadersCount ] ;
38
+ httpContext . Response . Headers [ headerName ] = "The quick brown fox jumps over the lazy dog." ;
25
39
if ( HeadersChange )
26
40
{
27
41
_headerIndex ++ ;
You can’t perform that action at this time.
0 commit comments