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

Allow creating a GenericGaugeVec with Vec<String> #399

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Allow creating a GenericGaugeVec with Vec<String> #399

wants to merge 1 commit into from

Conversation

vrmiguel
Copy link

@vrmiguel vrmiguel commented May 1, 2021

GenericGaugeVec::new's need for &[&str] can lead to inefficient code such as what can be seen here in The Graph's code, where a Vec<&str> is obtained from a Vec<String>, which is then sent as a slice to GenericGaugeVec::new, who clones the contents of the slice in order to again obtain a Vec<String>.

All those allocations could be avoided if there were a way of creating GenericGaugeVec with a Vec<String> directly, which is what this PR proposes.

The usage of GenericGaugeVec::new remains intact while a GenericGaugeVec::new_from_vec function has been added

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant