-
Notifications
You must be signed in to change notification settings - Fork 30.3k
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
src,url: separate some tables out of node_url.cc #38988
Conversation
The purpose of separating is for readability and maintainability.
src/node_url.h
Outdated
@@ -74,6 +74,16 @@ struct url_data { | |||
std::string href; | |||
}; | |||
|
|||
namespace table_data { | |||
extern const char* hex[256]; |
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.
extern const char* hex[256]; | |
extern const char* const hex[256]; |
(Aside -- using a single string of '%00\0%01\0%02\0...' and then accessing it as hex[index * 4]
saves a bit more space and probably improves cache locality a bit.)
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.
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.
Right – I didn’t say it would increase readability :)
As an alternative to a new *.cc file, these could be moved into a |
Because it's real data, not only declaration. If |
Should we add a TODO comment to move the variables to |
All we’d get out of that is probably just longer compilation times. @XadillaX is right, this is actual data that is accessed as data, so inlining has no benefit here and putting it in a .cc file is just the right thing to do, and I don’t understand why something else would be suggested here. |
The purpose of separating is for readability and maintainability. PR-URL: #38988 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Landed in 38a15d8 |
The purpose of separating is for readability and maintainability. PR-URL: nodejs#38988 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
The purpose of separating is for readability and maintainability. PR-URL: #38988 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
The purpose of separating is for readability and maintainability. PR-URL: #38988 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
The purpose of separating is for readability and maintainability. PR-URL: #38988 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
The purpose of separating is for readability and maintainability. PR-URL: nodejs#38988 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
The purpose of separating is for readability and maintainability.