-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
Replaced utstring with std::string #1009
Replaced utstring with std::string #1009
Conversation
Merged build finished. Test PASSed. |
Test PASSed. |
@@ -1451,7 +1444,7 @@ void process_object_notification(event_loop *loop, | |||
* into two structs, one for workers and one for other plasma managers. */ | |||
ClientConnection *ClientConnection_init(PlasmaManagerState *state, | |||
int client_sock, | |||
char *client_key) { | |||
const char *client_key) { |
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.
Does it make sense to go further and make client_key
a std::string
as well? And then to make conn->ip_addr_port
a std::string
? What do you think?
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.
Yes, that makes sense. I'll make those updates as well.
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.
In fact client_key should be a const std::string& :)
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.
Looks like ClientConnection
is still using the UT_hash
data structure which can't use std::string
as a key. I'll need to update that to an ordered map as well. Would you prefer I do that in a separate PR or can I make these changes in here as well?
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.
Keeping PRs as small as possible is best, why don't you make a separate one?
Side note: are the changed functions on a performance-critical path? Just wondering if string concat. should avoid the |
@concretevitamin Yeah, that's a really good point.. |
@concretevitamin @robertnishihara is the expected length of the final string known? Calling Otherwise, something like |
@concretevitamin @pschafhalter [cc @robertnishihara]
Generally, I would avoid spending time on such optimizations unless (a) the optimized version isn't too much harder to write (& read) than the original version, and (b) unless it is completely obvious that the optimized version will lack the bottlenecks. Otherwise, it's best to just wait until a profiler pinpoints potential hotspots. |
Thanks a lot @mehrdadn, that's super informative! And I love that the takeaway is that I don't have to do anything right now :) |
No description provided.