This repository was archived by the owner on Nov 6, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
simplify parsing M-SEARCH method, group P methods #323
Closed
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
can use same switch-lookup for '-' char case move PROPFIND and PURGE to be next to the other P methods change IS_ALPHA(ch) to A <= ch <= Z (very slight optimization, only uppercase will match in switch)
@@ -1007,7 +1007,7 @@ size_t http_parser_execute (http_parser *parser, | |||
UPDATE_STATE(s_req_spaces_before_url); | |||
} else if (ch == matcher[parser->index]) { | |||
; /* nada */ | |||
} else if (IS_ALPHA(ch)) { | |||
} else if ((ch >= 'A' && ch <= 'Z') || ch == '-') { |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
I am willing to make adjustments if desired, fwiw. |
@ploxiln there is no need in this! I'll land it in 24 hours if no one will reply. |
friendly ping 😁 |
O.o just saw this! sorry about that... LGTM if @indutny is happy with it. |
Closed
indutny
pushed a commit
that referenced
this pull request
Jun 14, 2017
can use same switch-lookup for '-' char case move PROPFIND and PURGE to be next to the other P methods change IS_ALPHA(ch) to A <= ch <= Z (very slight optimization, only uppercase will match in switch) PR-URL: #323 Reviewed-By: Fedor Indutny <[email protected]> Reviewed-By: James M Snell <[email protected]>
Landed in 1b79aba, thank you! Sorry for very very very long delay 😭 |
shekhei
pushed a commit
to shekhei/http-parser
that referenced
this pull request
Sep 19, 2017
can use same switch-lookup for '-' char case move PROPFIND and PURGE to be next to the other P methods change IS_ALPHA(ch) to A <= ch <= Z (very slight optimization, only uppercase will match in switch) PR-URL: nodejs#323 Reviewed-By: Fedor Indutny <[email protected]> Reviewed-By: James M Snell <[email protected]>
shekhei
pushed a commit
to shekhei/http-parser
that referenced
this pull request
Sep 19, 2017
can use same switch-lookup for '-' char case move PROPFIND and PURGE to be next to the other P methods change IS_ALPHA(ch) to A <= ch <= Z (very slight optimization, only uppercase will match in switch) PR-URL: nodejs#323 Reviewed-By: Fedor Indutny <[email protected]> Reviewed-By: James M Snell <[email protected]>
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.
This just makes the method verb parsing code a bit more elegant:
-
char case forM-SEARCH
also, change IS_ALPHA(ch) to just A <= ch <= Z
(very slight optimization, only uppercase will match in switch)
I tested with
./bench
on OS X and in a Linux VM, and performance is pretty much the same with this change, just an insignificant smidge faster. I tested branches in back/forth/back/forth pattern.But this isn't about the performance, just mostly about getting rid of the extra if statement just for the
M-Search
method.