-
Notifications
You must be signed in to change notification settings - Fork 314
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
Reduce allocations when working with ServiceGroup #1685
Conversation
ServiceGroup now contains a single string allocation and three functions to access parts of the service group. This allows us to greatly reduce the amount of string allocations when attempting to comopare the full representation of a service group instead of it's components. I also did a bit of work refactoring the public API of the key generation functions to make them easier to use Signed-off-by: Jamie Winsor <jamie@vialstudios.com>
Thanks for the pull request! Here is what will happen next:
Thank you for contributing! |
Err(format!("SERVICE_GROUP: '{}' is invalid", &val)) | ||
match ServiceGroup::validate(&val) { | ||
Ok(()) => Ok(()), | ||
Err(err) => Err(err.to_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.
very nice.
pub group: String, | ||
pub organization: Option<String>, | ||
} | ||
pub struct ServiceGroup(pub 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.
Oh. I see you are using a Jamie style struct!
This looks great! Very nice not to have to |
@thesentinels approve |
🤘 I am testing your branch against master before merging it. We do this to ensure that the master branch is never failing tests. |
Travis CI has started testing this PR. |
💖 Travis CI reports this PR passed. It always makes me feel nice when humans approve of one anothers work. I'm merging this PR now. I just want you and the contributor to answer me one question: |
ServiceGroup now contains a single string allocation and three
functions to access parts of the service group. This allows us
to greatly reduce the amount of string allocations when attempting
to comopare the full representation of a service group instead of
it's components.
I also did a bit of work refactoring the public API of the key
generation functions to make them easier to use