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"
13
13
travis-ci = { repository = " rust-lang/measureme" }
14
14
15
15
[dependencies ]
16
- rustc-hash = " 1.0.1"
17
16
parking_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
+
1
3
use crate :: { Profiler , StringComponent , StringId } ;
2
4
3
5
/// Event IDs are strings conforming to the following grammar:
@@ -80,8 +82,9 @@ impl<'p> EventIdBuilder<'p> {
80
82
}
81
83
82
84
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
+
85
88
parts. push ( StringComponent :: Ref ( label) ) ;
86
89
87
90
for arg in args {
You can’t perform that action at this time.
0 commit comments