Optimize has_duplicates() for short slices

This commit is contained in:
Greg Fitzgerald
2019-01-07 09:38:19 -07:00
parent 24963e547c
commit 6000df9779
2 changed files with 24 additions and 5 deletions

14
benches/runtime.rs Normal file
View File

@@ -0,0 +1,14 @@
#![feature(test)]
extern crate test;
use solana::runtime::*;
use test::Bencher;
#[bench]
fn bench_has_duplicates(bencher: &mut Bencher) {
bencher.iter(|| {
let data = test::black_box([1, 2, 3]);
assert!(!has_duplicates(&data));
})
}