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

Reduce allocations when working with ServiceGroup #1685

Merged
merged 1 commit into from
Jan 30, 2017

Conversation

reset
Copy link
Collaborator

@reset reset commented Jan 28, 2017

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

gif-keyboard-8803244473903942467

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>
@thesentinels
Copy link
Contributor

Thanks for the pull request! Here is what will happen next:

  1. Your PR will be reviewed by the maintainers
  2. If everything looks good, one of them will approve it, and your PR will be merged.

Thank you for contributing!

Err(format!("SERVICE_GROUP: '{}' is invalid", &val))
match ServiceGroup::validate(&val) {
Ok(()) => Ok(()),
Err(err) => Err(err.to_string()),
}
Copy link
Contributor

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

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!

@mwrock
Copy link
Contributor

mwrock commented Jan 30, 2017

This looks great! Very nice not to have to .to_string() everything too!

@mwrock
Copy link
Contributor

mwrock commented Jan 30, 2017

@thesentinels approve

@thesentinels
Copy link
Contributor

🤘 I am testing your branch against master before merging it. We do this to ensure that the master branch is never failing tests.

@thesentinels
Copy link
Contributor

:neckbeard: Travis CI has started testing this PR.

@thesentinels
Copy link
Contributor

💖 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:

gif-keyboard-3280869874741411265

@thesentinels thesentinels merged commit 8ff389d into master Jan 30, 2017
@thesentinels thesentinels deleted the reduce-sg-alloc branch January 30, 2017 12:58
@christophermaier christophermaier added Focus:Supervisor Related to the Habitat Supervisor (core/hab-sup) component Type: Chore Issues for general code and infrastructure maintenance and removed A-supervisor labels Jul 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Focus:Supervisor Related to the Habitat Supervisor (core/hab-sup) component Type: Chore Issues for general code and infrastructure maintenance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants