File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -13,5 +13,6 @@ repository = "https://github.com/rust-lang/measureme"
1313travis-ci = { repository = " rust-lang/measureme" }
1414
1515[dependencies ]
16- rustc-hash = " 1.0.1"
1716parking_lot = " 0.11.0"
17+ rustc-hash = " 1.0.1"
18+ smallvec = " 1.0"
Original file line number Diff line number Diff line change 1+ use smallvec:: SmallVec ;
2+
13use crate :: { Profiler , StringComponent , StringId } ;
24
35/// Event IDs are strings conforming to the following grammar:
@@ -80,8 +82,9 @@ impl<'p> EventIdBuilder<'p> {
8082 }
8183
8284 pub fn from_label_and_args ( & self , label : StringId , args : & [ StringId ] ) -> EventId {
83- // The capacity is the number of args + the same number for arg separators + the label.
84- let mut parts = Vec :: with_capacity ( args. len ( ) * 2 + 1 ) ;
85+ // Store up to 7 components on the stack: 1 label + 3 arguments + 3 argument separators
86+ let mut parts = SmallVec :: < [ StringComponent ; 7 ] > :: with_capacity ( 1 + args. len ( ) * 2 ) ;
87+
8588 parts. push ( StringComponent :: Ref ( label) ) ;
8689
8790 for arg in args {
You can’t perform that action at this time.
0 commit comments