(c: &mut Criterion)
| 99 | } |
| 100 | |
| 101 | fn from_object_slice(c: &mut Criterion) { |
| 102 | const SIZES: &[usize] = &[2_usize.pow(5), 2_usize.pow(10), 2_usize.pow(15)]; |
| 103 | |
| 104 | let mut group = c.benchmark_group("from_object_slice"); |
| 105 | for &size in SIZES { |
| 106 | Python::attach(|py| { |
| 107 | let vec = (0..size) |
| 108 | .map(|val| val.into_py_any(py).unwrap()) |
| 109 | .collect::<Vec<_>>(); |
| 110 | |
| 111 | group.throughput(Throughput::Elements(size as u64)); |
| 112 | group.bench_with_input(BenchmarkId::from_parameter(size), &size, |b, _size| { |
| 113 | b.iter(|| { |
| 114 | let slice = black_box(&vec[..]); |
| 115 | black_box(PyArray1::from_slice(py, slice)); |
| 116 | }); |
| 117 | }); |
| 118 | }); |
| 119 | } |
| 120 | } |
| 121 | |
| 122 | fn from_vec2(c: &mut Criterion) { |
| 123 | const SIZES: &[usize] = &[2_usize.pow(3), 2_usize.pow(5), 2_usize.pow(8)]; |
nothing calls this directly
no test coverage detected