This gist is for benchmark cloud-hypervisor/pull/6636.
- Setup project following quick start of https://github.com/bheisler/criterion.rs
- Copy 2 files of this gist to projects
- Run
cargo bench
smallvec-small time: [7.3033 ns 7.3213 ns 7.3414 ns] Found 1 outliers among 100 measurements (1.00%) 1 (1.00%) high mild
borrowed-small time: [3.5628 ns 3.5832 ns 3.6043 ns]
borrowed-small-pre-alloc time: [3.5657 ns 3.5848 ns 3.6037 ns] Found 1 outliers among 100 measurements (1.00%) 1 (1.00%) high mild
smallvec-mid time: [20.415 ns 20.467 ns 20.526 ns] Found 2 outliers among 100 measurements (2.00%) 2 (2.00%) high mild
borrowed-mid time: [8.3222 ns 8.3512 ns 8.3804 ns] Found 3 outliers among 100 measurements (3.00%) 3 (3.00%) high mild
smallvec-big time: [62.989 ns 63.117 ns 63.247 ns] Found 1 outliers among 100 measurements (1.00%) 1 (1.00%) high mild
borrowed-big time: [9.9654 ns 10.009 ns 10.053 ns] Found 1 outliers among 100 measurements (1.00%) 1 (1.00%) high mild
- For small data(size=3): borrowed vec only cost 48% CPU time of smallvec(size=4), and borrowed vec with pre-alloc's performance is near the result without it.
- For mid data(size=6): borrowed vec only cost 41% CPU time of smallvec(size=4)
- For big data(size=10): borrowed vec only cost 16% CPU time of smallvec(size=4)
Linux arch-ch 6.8.12-1-pve #1 SMP PREEMPT_DYNAMIC PMX 6.8.12-1 (2024-08-05T16:17Z) x86_64 GNU/Linux
AMD Ryzen 7 7840HS w/ Radeon 780M Graphics