From eaa796c8b885c0aecf0c85d8299a3b52cca72370 Mon Sep 17 00:00:00 2001 From: Michael Woerister Date: Mon, 21 May 2018 16:12:02 +0200 Subject: [PATCH] Remove benchmarks from SortedMap. --- src/librustc_data_structures/sorted_map.rs | 33 ++++++---------------- 1 file changed, 9 insertions(+), 24 deletions(-) diff --git a/src/librustc_data_structures/sorted_map.rs b/src/librustc_data_structures/sorted_map.rs index a8a43ebc1ad..c3f462f29c8 100644 --- a/src/librustc_data_structures/sorted_map.rs +++ b/src/librustc_data_structures/sorted_map.rs @@ -285,7 +285,6 @@ impl> From for SortedMap { #[cfg(test)] mod tests { use super::SortedMap; - use test::{self, Bencher}; #[test] fn test_insert_and_iter() { @@ -473,29 +472,15 @@ mod tests { assert_eq!(elements(map), expected); } - macro_rules! mk_bench { - ($name:ident, $size:expr) => ( - #[bench] - fn $name(b: &mut Bencher) { - let mut map = SortedMap::new(); - for x in 0 .. $size { - map.insert(x * 3, 0); - } + #[test] + fn test_insert_presorted_at_end() { + let mut map = SortedMap::new(); + map.insert(1, 1); + map.insert(2, 2); - b.iter(|| { - test::black_box(map.range(..)); - test::black_box(map.range( $size / 2.. $size )); - test::black_box(map.range( 0 .. $size / 3 )); - test::black_box(map.range( $size / 4 .. $size / 3 )); - }) - } - ) + map.insert_presorted(vec![(3, 3), (8, 8)]); + + let expected = vec![(1, 1), (2, 2), (3, 3), (8, 8)]; + assert_eq!(elements(map), expected); } - - mk_bench!(bench_range_1, 1); - mk_bench!(bench_range_2, 2); - mk_bench!(bench_range_5, 5); - mk_bench!(bench_range_10, 10); - mk_bench!(bench_range_32, 32); - mk_bench!(bench_range_1000, 1000); }