Seek perf extra

See https://github.com/aspnet/KestrelHttpServer/issues/541
This commit is contained in:
Ben Adams 2015-12-29 15:36:59 +00:00
parent 1eda5178de
commit 4c39800ea4
1 changed files with 9 additions and 9 deletions

View File

@ -217,9 +217,9 @@ namespace Microsoft.AspNet.Server.Kestrel.Infrastructure
return -1; return -1;
} }
var following = _block.End - _index;
var block = _block; var block = _block;
var index = _index; var index = _index;
var following = block.End - index;
byte[] array; byte[] array;
var byte0 = byte0Vector[0]; var byte0 = byte0Vector[0];
@ -264,9 +264,9 @@ namespace Microsoft.AspNet.Server.Kestrel.Infrastructure
#if !DEBUG // Need unit tests to test Vector path #if !DEBUG // Need unit tests to test Vector path
} }
#endif #endif
fixed (byte* ptr = block.Array) fixed (byte* ptr = &block.Array[index])
{ {
var pCurrent = ptr + index; var pCurrent = ptr;
var pEnd = pCurrent + following; var pEnd = pCurrent + following;
do do
{ {
@ -294,9 +294,9 @@ namespace Microsoft.AspNet.Server.Kestrel.Infrastructure
return -1; return -1;
} }
var following = _block.End - _index;
var block = _block; var block = _block;
var index = _index; var index = _index;
var following = block.End - index;
byte[] array; byte[] array;
int byte0Index = int.MaxValue; int byte0Index = int.MaxValue;
int byte1Index = int.MaxValue; int byte1Index = int.MaxValue;
@ -363,9 +363,9 @@ namespace Microsoft.AspNet.Server.Kestrel.Infrastructure
#if !DEBUG // Need unit tests to test Vector path #if !DEBUG // Need unit tests to test Vector path
} }
#endif #endif
fixed (byte* ptr = block.Array) fixed (byte* ptr = &block.Array[index])
{ {
var pCurrent = ptr + index; var pCurrent = ptr;
var pEnd = pCurrent + following; var pEnd = pCurrent + following;
do do
{ {
@ -399,9 +399,9 @@ namespace Microsoft.AspNet.Server.Kestrel.Infrastructure
return -1; return -1;
} }
var following = _block.End - _index;
var block = _block; var block = _block;
var index = _index; var index = _index;
var following = block.End - index;
byte[] array; byte[] array;
int byte0Index = int.MaxValue; int byte0Index = int.MaxValue;
int byte1Index = int.MaxValue; int byte1Index = int.MaxValue;
@ -496,9 +496,9 @@ namespace Microsoft.AspNet.Server.Kestrel.Infrastructure
#if !DEBUG // Need unit tests to test Vector path #if !DEBUG // Need unit tests to test Vector path
} }
#endif #endif
fixed (byte* ptr = block.Array) fixed (byte* ptr = &block.Array[index])
{ {
var pCurrent = ptr + index; var pCurrent = ptr;
var pEnd = pCurrent + following; var pEnd = pCurrent + following;
do do
{ {