File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
src/Benchmarks/Middleware Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change 10
10
using System . Threading . Tasks ;
11
11
using Benchmarks . Data ;
12
12
using Microsoft . AspNetCore . Http ;
13
+ using static Azure . Core . HttpHeader ;
13
14
14
15
namespace Benchmarks . Middleware
15
16
{
@@ -93,17 +94,19 @@ public void Advance(int count)
93
94
94
95
public void Commit ( )
95
96
{
96
- _inner . Advance ( _buffered ) ;
97
- _buffered = 0 ;
98
- _memory = default ;
97
+ if ( _buffered != 0 )
98
+ {
99
+ _inner . Advance ( _buffered ) ;
100
+ _buffered = 0 ;
101
+ _memory = default ;
102
+ }
99
103
}
100
104
101
105
public Memory < T > GetMemory ( int sizeHint = 0 )
102
106
{
103
107
if ( _memory . Length == 0 || _memory . Length < sizeHint )
104
108
{
105
- _inner . Advance ( _buffered ) ;
106
- _buffered = 0 ;
109
+ Commit ( ) ;
107
110
_memory = _inner . GetMemory ( sizeHint ) ;
108
111
}
109
112
return _memory ;
You can’t perform that action at this time.
0 commit comments