目前根据 bench 结果:
```
Gnuplot not found, using plotters backend
Anyhow/anyhow/v1.0.76 time: [46.255 ns 50.158 ns 54.338 ns]
change: [-3.3466% +7.6940% +20.010%] (p = 0.18 > 0.05)
No change in performance detected.
Found 5 outliers among 100 measurements (5.00%)
3 (3.00%) high mild
2 (2.00%) high severe
Anyhow/anyhow/v1.0.90 time: [48.072 ns 56.167 ns 63.721 ns]
change: [-29.746% +34.093% +175.67%] (p = 0.69 > 0.05)
No change in performance detected.
Found 16 outliers among 100 measurements (16.00%)
11 (11.00%) high mild
5 (5.00%) high severe
```
但是我的测试环境发生变动: AMD AI9 HX370, 7500MT LPDDR5.
```
rustc 1.84.0-nightly (e7c0d2750 2024-10-15)
binary: rustc
commit-hash: e7c0d2750726c1f08b1de6956248ec78c4a97af6
commit-date: 2024-10-15
host: x86_64-pc-windows-msvc
release: 1.84.0-nightly
LLVM version: 19.1.1
```
测试代码:
```rust
use criterion::{criterion_group, criterion_main, BatchSize, Criterion};
fn bench_maps(c: &mut Criterion) {
let mut group = c.benchmark_group("Anyhow");
group.bench_function("anyhow/v1.0.76", |b| {
b.iter_batched(
|| anyhow_1_0_76::anyhow!("test error"),
|e| {
criterion::black_box({
let _ = e;
});
},
BatchSize::SmallInput,
)
});
group.bench_function("anyhow/v1.0.90", |b| {
b.iter_batched(
|| anyhow_1_0_90::anyhow!("test error"),
|e| {
criterion::black_box({
let _ = e;
});
},
BatchSize::SmallInput,
)
});
}
criterion_group!(benches, bench_maps);
criterion_main!(benches);
```
切换至当前 stable rust 测试:
```
rustc 1.81.0 (eeb90cda1 2024-09-04)
binary: rustc
commit-hash: eeb90cda1969383f56a2637cbd3037bdf598841c
commit-date: 2024-09-04
host: x86_64-pc-windows-msvc
release: 1.81.0
LLVM version: 18.1.7
```
```
Running benches/
anyhow.rs (target\release\deps\anyhow-e035dda9f6eff98f.exe)
Gnuplot not found, using plotters backend
Anyhow/anyhow/v1.0.76 time: [7.3229 ns 7.5644 ns 7.9092 ns]
change: [-5.8063% -1.9072% +1.6252%] (p = 0.33 > 0.05)
No change in performance detected.
Found 7 outliers among 100 measurements (7.00%)
3 (3.00%) high mild
4 (4.00%) high severe
Anyhow/anyhow/v1.0.90 time: [46.830 ns 53.064 ns 59.741 ns]
change: [-16.795% -3.3065% +13.223%] (p = 0.68 > 0.05)
No change in performance detected.
Found 6 outliers among 100 measurements (6.00%)
3 (3.00%) high mild
3 (3.00%) high severe
```
emmm, 奇怪的结果.