-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
http2: general code cleanups #19400
http2: general code cleanups #19400
Conversation
Most of the inlines were leftovers from a much older design iteration and are largely pointless or counter productive.
Use of a MaybeStackBuffer was just silly. Fix a long standing todo Reduce code duplication a bit.
src/node_http2.cc
Outdated
}; | ||
session->MakeCallback(env->error_string(), arraysize(argv), argv); | ||
Local<Value> argv = Integer::New(isolate, lib_error_code); | ||
session->MakeCallback(env->error_string(), 1, &argv); |
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.
You may want to call this arg
, since it’s not really a vector any longer :)
(ditto below)
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.
LGTM
@@ -283,13 +251,13 @@ Http2Session::Http2Settings::~Http2Settings() { | |||
// Generates a Buffer that contains the serialized payload of a SETTINGS | |||
// frame. This can be used, for instance, to create the Base64-encoded | |||
// content of an Http2-Settings header field. | |||
inline Local<Value> Http2Session::Http2Settings::Pack() { | |||
Local<Value> Http2Session::Http2Settings::Pack() { |
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.
is it ok to remove this inline
directive here and in the other functions? Wouldn't this impact perf somehow?
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.
@mcollina It’s not only okay, it’s more or less the correct thing to do.
This has a pretty good explanation. tl;dr: Compilers are generally better than humans at judging what functions to inline or not, and will gladly ignore this advice. However, inline
does affect the linkage properties of a function, and so its primary use should be to mark functions that are defined in header files (outside of a class definition).
I just tested it with gcc, and the compiler output is the same before and after this commit, byte-for-byte.
Most of the inlines were leftovers from a much older design iteration and are largely pointless or counter productive. PR-URL: #19400 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Use of a MaybeStackBuffer was just silly. Fix a long standing todo Reduce code duplication a bit. PR-URL: #19400 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
PR-URL: #19400 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Most of the inlines were leftovers from a much older design iteration and are largely pointless or counter productive. PR-URL: #19400 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Use of a MaybeStackBuffer was just silly. Fix a long standing todo Reduce code duplication a bit. PR-URL: #19400 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
PR-URL: #19400 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Most of the inlines were leftovers from a much older design iteration and are largely pointless or counter productive. PR-URL: #19400 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Use of a MaybeStackBuffer was just silly. Fix a long standing todo Reduce code duplication a bit. PR-URL: #19400 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
PR-URL: #19400 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
@jasnell could you backport this to |
/cc @addaleax @mcollina
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes