diff --git a/utils/writeable/benches/writeable.rs b/utils/writeable/benches/writeable.rs index f0ccacd69c7..e8296b9317d 100644 --- a/utils/writeable/benches/writeable.rs +++ b/utils/writeable/benches/writeable.rs @@ -214,26 +214,23 @@ fn writeable_dyn_benches(c: &mut Criterion) { fn display_benches(c: &mut Criterion) { c.bench_function("display/to_string/short", |b| { b.iter(|| { - DisplayMessage { + std::string::ToString::to_string(&DisplayMessage { message: black_box(SHORT_STR), - } - .to_string() + }) }); }); c.bench_function("display/to_string/medium", |b| { b.iter(|| { - DisplayMessage { + std::string::ToString::to_string(&DisplayMessage { message: black_box(MEDIUM_STR), - } - .to_string() + }) }); }); c.bench_function("display/to_string/long", |b| { b.iter(|| { - DisplayMessage { + std::string::ToString::to_string(&DisplayMessage { message: black_box(LONG_STR), - } - .to_string() + }) }); }); c.bench_function("display/fmt/short", |b| { @@ -282,7 +279,9 @@ fn complex_benches(c: &mut Criterion) { }); }); c.bench_function("complex/display_to_string/medium", |b| { - b.iter(|| black_box(COMPLEX_WRITEABLE_MEDIUM).to_string()); + b.iter(|| { + std::string::ToString::to_string(&black_box(COMPLEX_WRITEABLE_MEDIUM)) + }); }); const REFERENCE_STRS: [&str; 6] = [ "There are 55 apples and 8124 oranges", diff --git a/utils/writeable/src/lib.rs b/utils/writeable/src/lib.rs index da7b52b78ad..5141a8e12f1 100644 --- a/utils/writeable/src/lib.rs +++ b/utils/writeable/src/lib.rs @@ -34,9 +34,9 @@ //! //! | Case | `Writeable` | `Display` | //! |---|---|---| -//! | Create string from single-string message (139 chars) | 19.999 ns | 22.133 ns | -//! | Create string from complex message | 35.838 ns | 87.703 ns | -//! | Write complex message to buffer | 56.855 ns | 64.971 ns | +//! | Create string from single-string message (139 chars) | 15.642 ns | 19.251 ns | +//! | Create string from complex message | 35.830 ns | 89.478 ns | +//! | Write complex message to buffer | 57.336 ns | 64.408 ns | //! //! # Examples //!