@@ -143,6 +143,8 @@ impl Profile {
143143
144144 let labels = {
145145 let mut lbls = Vec :: new ( ) ;
146+ // Using try_reserve_exact because it will be converted to Box<[]>,
147+ // so excess capacity would make that conversion more expensive.
146148 lbls. try_reserve_exact ( sample. labels . len ( ) ) ?;
147149 for label in & sample. labels {
148150 let key = self . try_intern ( label. key ) ?;
@@ -210,6 +212,8 @@ impl Profile {
210212
211213 let labels = {
212214 let mut lbls = Vec :: new ( ) ;
215+ // Using try_reserve_exact because it will be converted to Box<[]>,
216+ // so excess capacity would make that conversion more expensive.
213217 lbls. try_reserve_exact ( labels. len ( ) ) ?;
214218 for label in labels {
215219 let label = label. context ( "profile label failed to convert" ) ?;
@@ -413,8 +417,8 @@ impl Profile {
413417 profiles_dictionary : crate :: profiles:: collections:: Arc < ProfilesDictionary > ,
414418 ) -> io:: Result < Self > {
415419 let mut owned_sample_types = Vec :: new ( ) ;
416- // Using try_reserve_exact because it will be converted to a Box<[]>,
417- // so excess capacity would just make that conversion more expensive.
420+ // Using try_reserve_exact because it will be converted to Box<[]>,
421+ // so excess capacity would make that conversion more expensive.
418422 owned_sample_types. try_reserve_exact ( sample_types. len ( ) ) ?;
419423 owned_sample_types. extend ( sample_types. iter ( ) . map ( owned_types:: ValueType :: from) ) ;
420424 Self :: try_new_internal (
0 commit comments