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

Commit 4c39800

Browse files
committed
Seek perf extra
See #541
1 parent 1eda517 commit 4c39800

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
@@ -217,9 +217,9 @@ public unsafe int Seek(ref Vector<byte> byte0Vector)
217217
return -1;
218218
}
219219

220-
var following = _block.End - _index;
221220
var block = _block;
222221
var index = _index;
222+
var following = block.End - index;
223223
byte[] array;
224224
var byte0 = byte0Vector[0];
225225

@@ -264,9 +264,9 @@ public unsafe int Seek(ref Vector<byte> byte0Vector)
264264
#if !DEBUG // Need unit tests to test Vector path
265265
}
266266
#endif
267-
fixed (byte* ptr = block.Array)
267+
fixed (byte* ptr = &block.Array[index])
268268
{
269-
var pCurrent = ptr + index;
269+
var pCurrent = ptr;
270270
var pEnd = pCurrent + following;
271271
do
272272
{
@@ -294,9 +294,9 @@ public unsafe int Seek(ref Vector<byte> byte0Vector, ref Vector<byte> byte1Vecto
294294
return -1;
295295
}
296296

297-
var following = _block.End - _index;
298297
var block = _block;
299298
var index = _index;
299+
var following = block.End - index;
300300
byte[] array;
301301
int byte0Index = int.MaxValue;
302302
int byte1Index = int.MaxValue;
@@ -363,9 +363,9 @@ public unsafe int Seek(ref Vector<byte> byte0Vector, ref Vector<byte> byte1Vecto
363363
#if !DEBUG // Need unit tests to test Vector path
364364
}
365365
#endif
366-
fixed (byte* ptr = block.Array)
366+
fixed (byte* ptr = &block.Array[index])
367367
{
368-
var pCurrent = ptr + index;
368+
var pCurrent = ptr;
369369
var pEnd = pCurrent + following;
370370
do
371371
{
@@ -399,9 +399,9 @@ public unsafe int Seek(ref Vector<byte> byte0Vector, ref Vector<byte> byte1Vecto
399399
return -1;
400400
}
401401

402-
var following = _block.End - _index;
403402
var block = _block;
404403
var index = _index;
404+
var following = block.End - index;
405405
byte[] array;
406406
int byte0Index = int.MaxValue;
407407
int byte1Index = int.MaxValue;
@@ -496,9 +496,9 @@ public unsafe int Seek(ref Vector<byte> byte0Vector, ref Vector<byte> byte1Vecto
496496
#if !DEBUG // Need unit tests to test Vector path
497497
}
498498
#endif
499-
fixed (byte* ptr = block.Array)
499+
fixed (byte* ptr = &block.Array[index])
500500
{
501-
var pCurrent = ptr + index;
501+
var pCurrent = ptr;
502502
var pEnd = pCurrent + following;
503503
do
504504
{

0 commit comments

Comments
 (0)