Skip to content

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