Skip to content

Commit fff851f

Browse files
authored
benches: lexicographically ordered bench names (#180)
zero-pad bench names derived from payload size to improve lexicographic sorting (order matches payload size)
1 parent 38878a0 commit fff851f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

benches/parse.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ fn uri(c: &mut Criterion) {
124124
// 1b to 4096b
125125
for p in 0..=12 {
126126
let n = 1 << p;
127-
_uri(c, &format!("uri_{}b", n), [chunk_4k[..n].to_vec(), S.into()].concat().leak());
127+
_uri(c, &format!("uri_{:04}b", n), [chunk_4k[..n].to_vec(), S.into()].concat().leak());
128128
}
129129
}
130130

@@ -148,20 +148,20 @@ fn header(c: &mut Criterion) {
148148
for p in 0..=12 {
149149
let n = 1 << p;
150150
let payload = [&xfoobar_4k[..n], b": b", RNRN].concat().leak();
151-
_header(c, &format!("name_{}b", n), payload);
151+
_header(c, &format!("name_{:04}b", n), payload);
152152
}
153153

154154
// header values 1b to 4096b
155155
for p in 0..=12 {
156156
let n = 1 << p;
157157
let payload = [b"a: ", &xfoobar_4k[..n], RNRN].concat().leak();
158-
_header(c, &format!("value_{}b", n), payload);
158+
_header(c, &format!("value_{:04}b", n), payload);
159159
}
160160

161161
// 1 to 128
162162
for p in 0..=7 {
163163
let n = 1 << p;
164-
_header(c, &format!("count_{}", n), [TINY_RN.repeat(n), RN.into()].concat().leak());
164+
_header(c, &format!("count_{:03}", n), [TINY_RN.repeat(n), RN.into()].concat().leak());
165165
}
166166
}
167167

0 commit comments

Comments
 (0)