]> git.proxmox.com Git - rustc.git/blobdiff - vendor/itertools-0.8.2/benches/combinations_with_replacement.rs
Update upstream source from tag 'upstream/1.52.1+dfsg1'
[rustc.git] / vendor / itertools-0.8.2 / benches / combinations_with_replacement.rs
diff --git a/vendor/itertools-0.8.2/benches/combinations_with_replacement.rs b/vendor/itertools-0.8.2/benches/combinations_with_replacement.rs
new file mode 100644 (file)
index 0000000..0652e49
--- /dev/null
@@ -0,0 +1,34 @@
+#![feature(test)]
+
+extern crate itertools;
+extern crate test;
+
+use itertools::Itertools;
+use test::{black_box, Bencher};
+
+#[bench]
+fn comb_replacement_n10_k5(b: &mut Bencher) {
+    b.iter(|| {
+        for i in (0..10).combinations_with_replacement(5) {
+            black_box(i);
+        }
+    });
+}
+
+#[bench]
+fn comb_replacement_n5_k10(b: &mut Bencher) {
+    b.iter(|| {
+        for i in (0..5).combinations_with_replacement(10) {
+            black_box(i);
+        }
+    });
+}
+
+#[bench]
+fn comb_replacement_n10_k10(b: &mut Bencher) {
+    b.iter(|| {
+        for i in (0..10).combinations_with_replacement(10) {
+            black_box(i);
+        }
+    });
+}