]> git.lizzy.rs Git - rust.git/blob - library/std/benches/hash/set_ops.rs
Merge commit '3ae8faff4d46ad92f194c2a4b941c3152a701b31' into clippyup
[rust.git] / library / std / benches / hash / set_ops.rs
1 use std::collections::HashSet;
2 use test::Bencher;
3
4 #[bench]
5 fn set_difference(b: &mut Bencher) {
6     let small: HashSet<_> = (0..10).collect();
7     let large: HashSet<_> = (0..100).collect();
8
9     b.iter(|| small.difference(&large).count());
10 }
11
12 #[bench]
13 fn set_is_subset(b: &mut Bencher) {
14     let small: HashSet<_> = (0..10).collect();
15     let large: HashSet<_> = (0..100).collect();
16
17     b.iter(|| small.is_subset(&large));
18 }
19
20 #[bench]
21 fn set_intersection(b: &mut Bencher) {
22     let small: HashSet<_> = (0..10).collect();
23     let large: HashSet<_> = (0..100).collect();
24
25     b.iter(|| small.intersection(&large).count());
26 }
27
28 #[bench]
29 fn set_symmetric_difference(b: &mut Bencher) {
30     let small: HashSet<_> = (0..10).collect();
31     let large: HashSet<_> = (0..100).collect();
32
33     b.iter(|| small.symmetric_difference(&large).count());
34 }
35
36 #[bench]
37 fn set_union(b: &mut Bencher) {
38     let small: HashSet<_> = (0..10).collect();
39     let large: HashSet<_> = (0..100).collect();
40
41     b.iter(|| small.union(&large).count());
42 }