-
Notifications
You must be signed in to change notification settings - Fork 516
More Vector performance #1000
More Vector performance #1000
Conversation
|
Cool. Maybe we can get the System.Runtime.CompilerServices.Unsafe NuGet package a little above 125 downloads! Based on the micro benchmarks I did a few months back, this should be about 39% faster than what we have today with some large (~60KB) headers mixed in, and 32% faster for more normal sized (~2.5KB) headers. I'll have to to rerun with this PR to make sure the numbers haven' changed before merging. We'll also run the plaintext benchmark just to make sure nothing is worse. |
| var remaining = count; | ||
| while (true) | ||
| { | ||
| var following = block.End - index; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While you might not need to use the wasLastBlock pattern since we want to skip it anyway, I don't feel to good about using a different pattern for traversing blocks in this one place.
It certainly risks returning an invalid actual out param. While this might never technically be used today by callers to CopyTo with a null array, I don't think it's OK for it to ever be wrong in case it is used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to same pattern
|
Rebased the feedback into commit 2 so it stays with the correct commit tag, my git fu is improving |
|
There are some crazy cookie sizes in the wild 👍 |
|
I really want the overall benchmarks for this PR to be better since the microbenchmarks for the header validation showed a nice improvement. At least with the plaintext benchmarks, there doesn't seem to be an improvement. Maybe we'll see an improvement with larger request and response headers. BTW. Did you microbenchmark |
|
I'll do some standalone Unsafe vs new |
|
@benaadams did you end up doing more benchmarking? |
Some headers are pretty big e.g. Cookie and Content-Security-Policy
f01444a to
4847cc2
Compare
|
@halter73 @muratg some outliers which might be windows doing something or a quirk :( But mostly good Pre
Post
|
|
Though it probably needs some more TLC; my understanding of how Vectors and the jit interact has changed considerably since I first did this; and it will likely clash horribly with the MemoryPoolIterator changes #1138 |
|
Not sure what MemoryPoolIterator will be like post Pipelines so moved the Header Validate to #1301 |
|
Closing because pipelines change makes this unmergable |
Now Unsafe is in nuget, re-opening of (minus CopyBlk, as not sure about perf on that)
#811
#804
#812