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
common/options: pass by reference and use user-literals for size #18034
Conversation
for better performance. and for better consistency, pass by std::initializer_list. Signed-off-by: Kefu Chai <kchai@redhat.com>
8e365cf
to
0f8ed94
Compare
Signed-off-by: Kefu Chai <kchai@redhat.com>
0f8ed94
to
6788ea0
Compare
retest this please. |
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.
Lazy Giraffes Tatter Mindlessly
@@ -91,7 +91,7 @@ struct Option { | |||
std::vector<const char*> see_also; | |||
|
|||
value_t min, max; | |||
std::vector<std::string> enum_allowed; | |||
std::vector<const char*> enum_allowed; |
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.
Are we sure we want char* rather than std::string here? Not that I'm DEAD SET AGAINST IT, but if we're doing std::string operations with them elsewhere this might be a false economy.
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 am sure, for smaller memory foot print. a temporary std::string()
will be created from const char*
in Option::dump()
, and in Option::validate()
, STL offers operator==(const char*, const std::string)
.
@@ -599,7 +599,7 @@ std::vector<Option> get_global_options() { | |||
.set_description(""), | |||
|
|||
Option("ms_tcp_prefetch_max_size", Option::TYPE_INT, Option::LEVEL_ADVANCED) | |||
.set_default(4096) | |||
.set_default(4_K) |
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 excellent. Where are these literals defined?
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 in this file. line:144.
the failed one is caused by d7b29ac#r141996981, i believe |
No description provided.