Skip to content
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

Merged
merged 2 commits into from Sep 30, 2017

Conversation

tchaikov
Copy link
Contributor

No description provided.

for better performance. and for better consistency, pass by
std::initializer_list.

Signed-off-by: Kefu Chai <kchai@redhat.com>
Signed-off-by: Kefu Chai <kchai@redhat.com>
@tchaikov
Copy link
Contributor Author

retest this please.

Copy link
Contributor

@adamemerson adamemerson left a 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;
Copy link
Contributor

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.

Copy link
Contributor Author

@tchaikov tchaikov Sep 29, 2017

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)
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@tchaikov
Copy link
Contributor Author

the failed one is caused by d7b29ac#r141996981, i believe

@tchaikov tchaikov merged commit 48582cb into ceph:master Sep 30, 2017
@tchaikov tchaikov deleted the wip-options branch September 30, 2017 04:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants