-
Notifications
You must be signed in to change notification settings - Fork 224
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 improvements in HTTP protocol #444
Perf improvements in HTTP protocol #444
Conversation
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
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.
Microoptimizations are fun! I like :)
require.Equal(t, e.ID(), sv.Attribute("Ce-Id").Get(e.Context)) | ||
require.Equal(t, "id", sv.Attribute("Ce-Id").Name()) | ||
|
||
require.Equal(t, e.DataContentType(), sv.Attribute("Content-Type").Get(e.Context)) |
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.
This is only true for binary mode.
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 know that, Version
and related interfaces are used only for binary messages
LGTM |
Because
net/http.Header
states that headers are keyed by their canonical mime header representation (https://golang.org/pkg/net/http/#Header), I optimized on avoiding any middle allocations for accessing the attributes map and i pre-compute the header names for the various attributes.I've also rewrote the computation of the extension key, in order to allocate only one new string.
Results