-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
perf: http/1 use table for lower case conversion #231
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -148,6 +148,13 @@ class ConnectionImpl : public virtual Connection, protected Logger::Loggable<Log | |
private: | ||
enum class HeaderParsingState { Field, Value, Done }; | ||
|
||
struct ToLowerTable { | ||
ToLowerTable(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i think default ctor is not necessary here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it is. we setup the table in the constructor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. my bad :) |
||
void toLowerCase(HeaderString& text) const; | ||
|
||
std::array<uint8_t, 256> table_; | ||
}; | ||
|
||
/** | ||
* Called in order to complete an in progress header decode. | ||
*/ | ||
|
@@ -219,6 +226,7 @@ class ConnectionImpl : public virtual Connection, protected Logger::Loggable<Log | |
virtual void sendProtocolError() PURE; | ||
|
||
static http_parser_settings settings_; | ||
static const ToLowerTable to_lower_table_; | ||
|
||
HeaderMapImplPtr current_header_map_; | ||
HeaderParsingState header_parsing_state_{HeaderParsingState::Field}; | ||
|
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.
Been a while since I optimized at this level, but would it help to use
restrict
onbuffer
to indicate that it can't overlap withtable_
?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.
I have no idea :) I will look into it.