We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a8aac58 commit 7f5e79fCopy full SHA for 7f5e79f
benches/array.rs
@@ -30,6 +30,27 @@ fn extract_failure(bencher: &mut Bencher) {
30
});
31
}
32
33
+#[bench]
34
+fn downcast_success(bencher: &mut Bencher) {
35
+ Python::with_gil(|py| {
36
+ let any: &PyAny = PyArray2::<f64>::zeros(py, (10, 10), false);
37
+
38
+ bencher.iter(|| {
39
+ black_box(any).downcast::<PyArray2<f64>>().unwrap();
40
+ });
41
42
+}
43
44
45
+fn downcast_failure(bencher: &mut Bencher) {
46
47
+ let any: &PyAny = PyArray2::<i32>::zeros(py, (10, 10), false);
48
49
50
+ black_box(any).downcast::<PyArray2<f64>>().unwrap_err();
51
52
53
54
struct Iter(Range<usize>);
55
56
impl Iterator for Iter {
0 commit comments