We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2952685 commit aaf8ba7Copy full SHA for aaf8ba7
src/libstd/num/mod.rs
@@ -1684,3 +1684,24 @@ mod tests {
1684
assert_pow(2u64, 50);
1685
}
1686
1687
+
1688
1689
+#[cfg(test)]
1690
+mod bench {
1691
+ use num;
1692
+ use vec;
1693
+ use prelude::*;
1694
+ use extra::test::BenchHarness;
1695
1696
+ #[bench]
1697
+ fn bench_pow_function(b: &mut BenchHarness) {
1698
+ let v = vec::from_fn(1024, |n| n);
1699
+ b.iter(|| {v.iter().fold(0, |old, new| num::pow(old, *new));});
1700
+ }
1701
1702
1703
+ fn bench_pow_with_uint_function(b: &mut BenchHarness) {
1704
1705
+ b.iter(|| {v.iter().fold(0, |old, new| num::pow_with_uint(old, *new));});
1706
1707
+}
0 commit comments