We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1230e55 commit c6ba5c0Copy full SHA for c6ba5c0
benches/benchmarks.rs
@@ -27,12 +27,22 @@ pub fn parse_asctime(c: &mut Criterion) {
27
});
28
}
29
30
+struct BlackBoxWrite;
31
+
32
+impl std::fmt::Write for BlackBoxWrite {
33
+ fn write_str(&mut self, s: &str) -> Result<(), std::fmt::Error> {
34
+ black_box(s);
35
+ Ok(())
36
+ }
37
+}
38
39
pub fn encode_date(c: &mut Criterion) {
40
c.bench_function("encode_date", |b| {
41
let d = "Wed, 21 Oct 2015 07:28:00 GMT";
42
black_box(httpdate::parse_http_date(d)).unwrap();
43
b.iter(|| {
- black_box(format!("{}", black_box(d)));
44
+ use std::fmt::Write;
45
+ let _ = write!(BlackBoxWrite, "{}", d);
46
})
47
48
0 commit comments