use ndarray::prelude::*; use criterion::{criterion_group, criterion_main, Criterion}; #[allow(dead_code)] #[allow(unused_variables)] pub fn fn_array() { let ndim = 1000; let arr1: Array = Array::ones((ndim, ndim)); let arr2: Array = Array::ones((ndim, ndim)); let number_loops: usize = 100; let mut arr12: Array2 = Array::ones((ndim, ndim)); for i in 0..number_loops { for j in 0..ndim { arr12[[i, j]] = 1; } } } #[allow(dead_code)] pub fn ndarray_bench(c: &mut Criterion) { c.bench_function("Bench the ndarray function", |b| b.iter(|| fn_array())); } criterion_group!(benches, ndarray_bench); criterion_main!(benches);