Skip to content
This repository was archived by the owner on Dec 18, 2018. It is now read-only.

Commit e344487

Browse files
committed
Seek perf extra
See #541
1 parent 5d589e6 commit e344487

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/Microsoft.AspNet.Server.Kestrel/Infrastructure/MemoryPoolIterator2.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,9 @@ public unsafe int Seek(ref Vector<byte> byte0Vector)
177177
return -1;
178178
}
179179

180-
var following = _block.End - _index;
181180
var block = _block;
182181
var index = _index;
182+
var following = block.End - index;
183183
byte[] array;
184184
var byte0 = byte0Vector[0];
185185

@@ -224,9 +224,9 @@ public unsafe int Seek(ref Vector<byte> byte0Vector)
224224
#if !DEBUG // Need unit tests to test Vector path
225225
}
226226
#endif
227-
fixed (byte* ptr = block.Array)
227+
fixed (byte* ptr = &block.Array[index])
228228
{
229-
var pCurrent = ptr + index;
229+
var pCurrent = ptr;
230230
var pEnd = pCurrent + following;
231231
do
232232
{
@@ -254,9 +254,9 @@ public unsafe int Seek(ref Vector<byte> byte0Vector, ref Vector<byte> byte1Vecto
254254
return -1;
255255
}
256256

257-
var following = _block.End - _index;
258257
var block = _block;
259258
var index = _index;
259+
var following = block.End - index;
260260
byte[] array;
261261
int byte0Index = int.MaxValue;
262262
int byte1Index = int.MaxValue;
@@ -323,9 +323,9 @@ public unsafe int Seek(ref Vector<byte> byte0Vector, ref Vector<byte> byte1Vecto
323323
#if !DEBUG // Need unit tests to test Vector path
324324
}
325325
#endif
326-
fixed (byte* ptr = block.Array)
326+
fixed (byte* ptr = &block.Array[index])
327327
{
328-
var pCurrent = ptr + index;
328+
var pCurrent = ptr;
329329
var pEnd = pCurrent + following;
330330
do
331331
{
@@ -359,9 +359,9 @@ public unsafe int Seek(ref Vector<byte> byte0Vector, ref Vector<byte> byte1Vecto
359359
return -1;
360360
}
361361

362-
var following = _block.End - _index;
363362
var block = _block;
364363
var index = _index;
364+
var following = block.End - index;
365365
byte[] array;
366366
int byte0Index = int.MaxValue;
367367
int byte1Index = int.MaxValue;
@@ -456,9 +456,9 @@ public unsafe int Seek(ref Vector<byte> byte0Vector, ref Vector<byte> byte1Vecto
456456
#if !DEBUG // Need unit tests to test Vector path
457457
}
458458
#endif
459-
fixed (byte* ptr = block.Array)
459+
fixed (byte* ptr = &block.Array[index])
460460
{
461-
var pCurrent = ptr + index;
461+
var pCurrent = ptr;
462462
var pEnd = pCurrent + following;
463463
do
464464
{

0 commit comments

Comments
 (0)