This repository was archived by the owner on Dec 18, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 523
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4e97e06
to
3297a9a
Compare
benaadams
commented
Jan 10, 2017
ThrowInvalidHeaderCharacter(ch); | ||
var stringUint = (uint*)(pHeader + offset); | ||
offset += sizeof(uint); | ||
if (((*stringUint | (*stringUint + 0x00010001u) | (*stringUint - 0x00200020u)) & 0xff80ff80u) != 0) |
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.
Don't need to *stringUint |
as (*stringUint - 0x00200020u)
should pickup the high sets
Updated with benchmarks (Vector-size 16, will be different for vector 32/64) |
{ | ||
var vSub = Vector.AsVectorUInt16(new Vector<uint>(0x00200020u)); | ||
// 0x7e as highest ascii (don't include DEL) | ||
// 0x20 as lowerest ascii (space) |
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.
lowerest?
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.
Fixed :)
4436860
to
bcac831
Compare
Rebased |
Better testing using benchmark from #1308 Before
After
|
7cfade2
to
0d11a89
Compare
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
x 1.9 times faster for plaintext (
13
+text/plain
)x 2.5 - 3.5 times faster for longer headers like
Content-Security-Policy
or large cookiesNewer version of part of #1000 "More Vector performance" for
ValidateHeaderCharacters
Testing at https://github.com/benaadams/PerfTesting/tree/master/src/HeaderValidation
/cc @halter73