From b8811d3545637a07f94f8a81963b6f38f3a6480e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Crozet=20S=C3=A9bastien?= Date: Mon, 12 Apr 2021 10:52:17 +0200 Subject: [PATCH] Fix compilation of benchmarks --- benches/common/macros.rs | 6 ++-- benches/core/matrix.rs | 6 ++-- benches/core/vector.rs | 15 +++++---- benches/lib.rs | 5 +-- benches/linalg/bidiagonal.rs | 10 +++--- benches/linalg/cholesky.rs | 4 +-- benches/linalg/full_piv_lu.rs | 18 +++++------ benches/linalg/hessenberg.rs | 8 ++--- benches/linalg/lu.rs | 20 ++++++------ benches/linalg/qr.rs | 16 +++++----- benches/linalg/schur.rs | 16 +++++----- benches/linalg/svd.rs | 32 ++++++++++---------- benches/linalg/symmetric_eigen.rs | 8 ++--- nalgebra-lapack/benches/linalg/hessenberg.rs | 6 ++-- nalgebra-lapack/benches/linalg/lu.rs | 10 +++--- nalgebra-lapack/benches/linalg/qr.rs | 10 +++--- 16 files changed, 94 insertions(+), 96 deletions(-) diff --git a/benches/common/macros.rs b/benches/common/macros.rs index 43bcf59d..3f775958 100644 --- a/benches/common/macros.rs +++ b/benches/common/macros.rs @@ -60,7 +60,7 @@ macro_rules! bench_unop_na( i = (i + 1) & (LEN - 1); unsafe { - test::black_box(na::$unop(elems.get_unchecked(i))) + std::hint::black_box(na::$unop(elems.get_unchecked(i))) } })); } @@ -82,7 +82,7 @@ macro_rules! bench_unop( i = (i + 1) & (LEN - 1); unsafe { - test::black_box(elems.get_unchecked_mut(i).$unop()) + std::hint::black_box(elems.get_unchecked_mut(i).$unop()) } })); } @@ -105,7 +105,7 @@ macro_rules! bench_construction( unsafe { let res = $constructor($(*$args.get_unchecked(i),)*); - test::black_box(res) + std::hint::black_box(res) } })); } diff --git a/benches/core/matrix.rs b/benches/core/matrix.rs index af716e9e..df4a5a5b 100644 --- a/benches/core/matrix.rs +++ b/benches/core/matrix.rs @@ -116,8 +116,8 @@ fn mat10_mul_mat10(bench: &mut criterion::Criterion) { } fn mat10_mul_mat10_static(bench: &mut criterion::Criterion) { - let a = OMatrix::::new_random(); - let b = OMatrix::::new_random(); + let a = OMatrix::::new_random(); + let b = OMatrix::::new_random(); bench.bench_function("mat10_mul_mat10_static", move |bh| bh.iter(|| &a * &b)); } @@ -198,7 +198,7 @@ fn mat_mul_mat(bench: &mut criterion::Criterion) { bench.bench_function("mat_mul_mat", move |bh| { bh.iter(|| { - test::black_box(a.mul_to(&b, &mut ab)); + std::hint::black_box(a.mul_to(&b, &mut ab)); }) }); } diff --git a/benches/core/vector.rs b/benches/core/vector.rs index eaee542d..66025bc5 100644 --- a/benches/core/vector.rs +++ b/benches/core/vector.rs @@ -1,8 +1,7 @@ -use na::{DVector, OVector, Vector2, Vector3, Vector4}; +use na::{DVector, SVector, Vector2, Vector3, Vector4}; use rand::Rng; use rand_isaac::IsaacRng; use std::ops::{Add, Div, Mul, Sub}; -use typenum::U10000; #[path = "../common/macros.rs"] mod macros; @@ -45,8 +44,8 @@ bench_unop!(vec2_normalize, Vector2, normalize); bench_unop!(vec3_normalize, Vector3, normalize); bench_unop!(vec4_normalize, Vector4, normalize); -bench_binop_ref!(vec10000_dot_f64, OVector, OVector, dot); -bench_binop_ref!(vec10000_dot_f32, OVector, OVector, dot); +bench_binop_ref!(vec10000_dot_f64, SVector, SVector, dot); +bench_binop_ref!(vec10000_dot_f32, SVector, SVector, dot); fn vec10000_axpy_f64(bh: &mut criterion::Criterion) { use rand::SeedableRng; @@ -82,8 +81,8 @@ fn vec10000_axpy_f64_slice(bh: &mut criterion::Criterion) { bh.bench_function("vec10000_axpy_f64_slice", move |bh| { bh.iter(|| { - let mut a = a.fixed_rows_mut::(0); - let b = b.fixed_rows::(0); + let mut a = a.fixed_rows_mut::<10000>(0); + let b = b.fixed_rows::<10000>(0); a.axpy(n, &b, 1.0) }) @@ -93,8 +92,8 @@ fn vec10000_axpy_f64_slice(bh: &mut criterion::Criterion) { fn vec10000_axpy_f64_static(bh: &mut criterion::Criterion) { use rand::SeedableRng; let mut rng = IsaacRng::seed_from_u64(0); - let mut a = OVector::::new_random(); - let b = OVector::::new_random(); + let mut a = SVector::::new_random(); + let b = SVector::::new_random(); let n = rng.gen::(); // NOTE: for some reasons, it is much faster if the arument are boxed (Box::new(OVector...)). diff --git a/benches/lib.rs b/benches/lib.rs index e4215a12..a77cc743 100644 --- a/benches/lib.rs +++ b/benches/lib.rs @@ -2,10 +2,7 @@ #![allow(unused_macros)] extern crate nalgebra as na; -extern crate rand; -extern crate rand_isaac; -extern crate test; -extern crate typenum; +extern crate rand_package as rand; #[macro_use] extern crate criterion; diff --git a/benches/linalg/bidiagonal.rs b/benches/linalg/bidiagonal.rs index ad875264..fe96c772 100644 --- a/benches/linalg/bidiagonal.rs +++ b/benches/linalg/bidiagonal.rs @@ -7,35 +7,35 @@ mod macros; fn bidiagonalize_100x100(bh: &mut criterion::Criterion) { let m = DMatrix::::new_random(100, 100); bh.bench_function("bidiagonalize_100x100", move |bh| { - bh.iter(|| test::black_box(Bidiagonal::new(m.clone()))) + bh.iter(|| std::hint::black_box(Bidiagonal::new(m.clone()))) }); } fn bidiagonalize_100x500(bh: &mut criterion::Criterion) { let m = DMatrix::::new_random(100, 500); bh.bench_function("bidiagonalize_100x500", move |bh| { - bh.iter(|| test::black_box(Bidiagonal::new(m.clone()))) + bh.iter(|| std::hint::black_box(Bidiagonal::new(m.clone()))) }); } fn bidiagonalize_4x4(bh: &mut criterion::Criterion) { let m = Matrix4::::new_random(); bh.bench_function("bidiagonalize_4x4", move |bh| { - bh.iter(|| test::black_box(Bidiagonal::new(m.clone()))) + bh.iter(|| std::hint::black_box(Bidiagonal::new(m.clone()))) }); } fn bidiagonalize_500x100(bh: &mut criterion::Criterion) { let m = DMatrix::::new_random(500, 100); bh.bench_function("bidiagonalize_500x100", move |bh| { - bh.iter(|| test::black_box(Bidiagonal::new(m.clone()))) + bh.iter(|| std::hint::black_box(Bidiagonal::new(m.clone()))) }); } fn bidiagonalize_500x500(bh: &mut criterion::Criterion) { let m = DMatrix::::new_random(500, 500); bh.bench_function("bidiagonalize_500x500", move |bh| { - bh.iter(|| test::black_box(Bidiagonal::new(m.clone()))) + bh.iter(|| std::hint::black_box(Bidiagonal::new(m.clone()))) }); } diff --git a/benches/linalg/cholesky.rs b/benches/linalg/cholesky.rs index a03888f5..09c80642 100644 --- a/benches/linalg/cholesky.rs +++ b/benches/linalg/cholesky.rs @@ -5,7 +5,7 @@ fn cholesky_100x100(bh: &mut criterion::Criterion) { let m = &m * m.transpose(); bh.bench_function("cholesky_100x100", move |bh| { - bh.iter(|| test::black_box(Cholesky::new(m.clone()))) + bh.iter(|| std::hint::black_box(Cholesky::new(m.clone()))) }); } @@ -14,7 +14,7 @@ fn cholesky_500x500(bh: &mut criterion::Criterion) { let m = &m * m.transpose(); bh.bench_function("cholesky_500x500", move |bh| { - bh.iter(|| test::black_box(Cholesky::new(m.clone()))) + bh.iter(|| std::hint::black_box(Cholesky::new(m.clone()))) }); } diff --git a/benches/linalg/full_piv_lu.rs b/benches/linalg/full_piv_lu.rs index dfd176da..748b6b05 100644 --- a/benches/linalg/full_piv_lu.rs +++ b/benches/linalg/full_piv_lu.rs @@ -4,21 +4,21 @@ use na::{DMatrix, DVector, FullPivLU}; fn full_piv_lu_decompose_10x10(bh: &mut criterion::Criterion) { let m = DMatrix::::new_random(10, 10); bh.bench_function("full_piv_lu_decompose_10x10", move |bh| { - bh.iter(|| test::black_box(FullPivLU::new(m.clone()))) + bh.iter(|| std::hint::black_box(FullPivLU::new(m.clone()))) }); } fn full_piv_lu_decompose_100x100(bh: &mut criterion::Criterion) { let m = DMatrix::::new_random(100, 100); bh.bench_function("full_piv_lu_decompose_100x100", move |bh| { - bh.iter(|| test::black_box(FullPivLU::new(m.clone()))) + bh.iter(|| std::hint::black_box(FullPivLU::new(m.clone()))) }); } fn full_piv_lu_decompose_500x500(bh: &mut criterion::Criterion) { let m = DMatrix::::new_random(500, 500); bh.bench_function("full_piv_lu_decompose_500x500", move |bh| { - bh.iter(|| test::black_box(FullPivLU::new(m.clone()))) + bh.iter(|| std::hint::black_box(FullPivLU::new(m.clone()))) }); } @@ -63,7 +63,7 @@ fn full_piv_lu_inverse_10x10(bh: &mut criterion::Criterion) { let lu = FullPivLU::new(m.clone()); bh.bench_function("full_piv_lu_inverse_10x10", move |bh| { - bh.iter(|| test::black_box(lu.try_inverse())) + bh.iter(|| std::hint::black_box(lu.try_inverse())) }); } @@ -72,7 +72,7 @@ fn full_piv_lu_inverse_100x100(bh: &mut criterion::Criterion) { let lu = FullPivLU::new(m.clone()); bh.bench_function("full_piv_lu_inverse_100x100", move |bh| { - bh.iter(|| test::black_box(lu.try_inverse())) + bh.iter(|| std::hint::black_box(lu.try_inverse())) }); } @@ -81,7 +81,7 @@ fn full_piv_lu_inverse_500x500(bh: &mut criterion::Criterion) { let lu = FullPivLU::new(m.clone()); bh.bench_function("full_piv_lu_inverse_500x500", move |bh| { - bh.iter(|| test::black_box(lu.try_inverse())) + bh.iter(|| std::hint::black_box(lu.try_inverse())) }); } @@ -90,7 +90,7 @@ fn full_piv_lu_determinant_10x10(bh: &mut criterion::Criterion) { let lu = FullPivLU::new(m.clone()); bh.bench_function("full_piv_lu_determinant_10x10", move |bh| { - bh.iter(|| test::black_box(lu.determinant())) + bh.iter(|| std::hint::black_box(lu.determinant())) }); } @@ -99,7 +99,7 @@ fn full_piv_lu_determinant_100x100(bh: &mut criterion::Criterion) { let lu = FullPivLU::new(m.clone()); bh.bench_function("full_piv_lu_determinant_100x100", move |bh| { - bh.iter(|| test::black_box(lu.determinant())) + bh.iter(|| std::hint::black_box(lu.determinant())) }); } @@ -108,7 +108,7 @@ fn full_piv_lu_determinant_500x500(bh: &mut criterion::Criterion) { let lu = FullPivLU::new(m.clone()); bh.bench_function("full_piv_lu_determinant_500x500", move |bh| { - bh.iter(|| test::black_box(lu.determinant())) + bh.iter(|| std::hint::black_box(lu.determinant())) }); } diff --git a/benches/linalg/hessenberg.rs b/benches/linalg/hessenberg.rs index a989616c..a2aabb80 100644 --- a/benches/linalg/hessenberg.rs +++ b/benches/linalg/hessenberg.rs @@ -7,28 +7,28 @@ mod macros; fn hessenberg_decompose_4x4(bh: &mut criterion::Criterion) { let m = Matrix4::::new_random(); bh.bench_function("hessenberg_decompose_4x4", move |bh| { - bh.iter(|| test::black_box(Hessenberg::new(m.clone()))) + bh.iter(|| std::hint::black_box(Hessenberg::new(m.clone()))) }); } fn hessenberg_decompose_100x100(bh: &mut criterion::Criterion) { let m = DMatrix::::new_random(100, 100); bh.bench_function("hessenberg_decompose_100x100", move |bh| { - bh.iter(|| test::black_box(Hessenberg::new(m.clone()))) + bh.iter(|| std::hint::black_box(Hessenberg::new(m.clone()))) }); } fn hessenberg_decompose_200x200(bh: &mut criterion::Criterion) { let m = DMatrix::::new_random(200, 200); bh.bench_function("hessenberg_decompose_200x200", move |bh| { - bh.iter(|| test::black_box(Hessenberg::new(m.clone()))) + bh.iter(|| std::hint::black_box(Hessenberg::new(m.clone()))) }); } fn hessenberg_decompose_500x500(bh: &mut criterion::Criterion) { let m = DMatrix::::new_random(500, 500); bh.bench_function("hessenberg_decompose_500x500", move |bh| { - bh.iter(|| test::black_box(Hessenberg::new(m.clone()))) + bh.iter(|| std::hint::black_box(Hessenberg::new(m.clone()))) }); } diff --git a/benches/linalg/lu.rs b/benches/linalg/lu.rs index c42cd499..2b2ab972 100644 --- a/benches/linalg/lu.rs +++ b/benches/linalg/lu.rs @@ -4,21 +4,21 @@ use na::{DMatrix, DVector, LU}; fn lu_decompose_10x10(bh: &mut criterion::Criterion) { let m = DMatrix::::new_random(10, 10); bh.bench_function("lu_decompose_10x10", move |bh| { - bh.iter(|| test::black_box(LU::new(m.clone()))) + bh.iter(|| std::hint::black_box(LU::new(m.clone()))) }); } fn lu_decompose_100x100(bh: &mut criterion::Criterion) { let m = DMatrix::::new_random(100, 100); bh.bench_function("lu_decompose_100x100", move |bh| { - bh.iter(|| test::black_box(LU::new(m.clone()))) + bh.iter(|| std::hint::black_box(LU::new(m.clone()))) }); } fn lu_decompose_500x500(bh: &mut criterion::Criterion) { let m = DMatrix::::new_random(500, 500); bh.bench_function("lu_decompose_500x500", move |bh| { - bh.iter(|| test::black_box(LU::new(m.clone()))) + bh.iter(|| std::hint::black_box(LU::new(m.clone()))) }); } @@ -63,7 +63,7 @@ fn lu_inverse_10x10(bh: &mut criterion::Criterion) { let lu = LU::new(m.clone()); bh.bench_function("lu_inverse_10x10", move |bh| { - bh.iter(|| test::black_box(lu.try_inverse())) + bh.iter(|| std::hint::black_box(lu.try_inverse())) }); } @@ -72,7 +72,7 @@ fn lu_inverse_100x100(bh: &mut criterion::Criterion) { let lu = LU::new(m.clone()); bh.bench_function("lu_inverse_100x100", move |bh| { - bh.iter(|| test::black_box(lu.try_inverse())) + bh.iter(|| std::hint::black_box(lu.try_inverse())) }); } @@ -81,7 +81,7 @@ fn lu_inverse_500x500(bh: &mut criterion::Criterion) { let lu = LU::new(m.clone()); bh.bench_function("lu_inverse_500x500", move |bh| { - bh.iter(|| test::black_box(lu.try_inverse())) + bh.iter(|| std::hint::black_box(lu.try_inverse())) }); } @@ -90,7 +90,7 @@ fn lu_determinant_10x10(bh: &mut criterion::Criterion) { let lu = LU::new(m.clone()); bh.bench_function("lu_determinant_10x10", move |bh| { - bh.iter(|| test::black_box(lu.determinant())) + bh.iter(|| std::hint::black_box(lu.determinant())) }); } @@ -99,7 +99,7 @@ fn lu_determinant_100x100(bh: &mut criterion::Criterion) { let lu = LU::new(m.clone()); bh.bench_function("lu_determinant_100x100", move |bh| { - bh.iter(|| test::black_box(lu.determinant())) + bh.iter(|| std::hint::black_box(lu.determinant())) }); } @@ -107,7 +107,9 @@ fn lu_determinant_500x500(bh: &mut criterion::Criterion) { let m = DMatrix::::new_random(500, 500); let lu = LU::new(m.clone()); - bh.bench_function("", move |bh| bh.iter(|| test::black_box(lu.determinant()))); + bh.bench_function("", move |bh| { + bh.iter(|| std::hint::black_box(lu.determinant())) + }); } criterion_group!( diff --git a/benches/linalg/qr.rs b/benches/linalg/qr.rs index d896f978..0c62b9ea 100644 --- a/benches/linalg/qr.rs +++ b/benches/linalg/qr.rs @@ -7,35 +7,35 @@ mod macros; fn qr_decompose_100x100(bh: &mut criterion::Criterion) { let m = DMatrix::::new_random(100, 100); bh.bench_function("qr_decompose_100x100", move |bh| { - bh.iter(|| test::black_box(QR::new(m.clone()))) + bh.iter(|| std::hint::black_box(QR::new(m.clone()))) }); } fn qr_decompose_100x500(bh: &mut criterion::Criterion) { let m = DMatrix::::new_random(100, 500); bh.bench_function("qr_decompose_100x500", move |bh| { - bh.iter(|| test::black_box(QR::new(m.clone()))) + bh.iter(|| std::hint::black_box(QR::new(m.clone()))) }); } fn qr_decompose_4x4(bh: &mut criterion::Criterion) { let m = Matrix4::::new_random(); bh.bench_function("qr_decompose_4x4", move |bh| { - bh.iter(|| test::black_box(QR::new(m.clone()))) + bh.iter(|| std::hint::black_box(QR::new(m.clone()))) }); } fn qr_decompose_500x100(bh: &mut criterion::Criterion) { let m = DMatrix::::new_random(500, 100); bh.bench_function("qr_decompose_500x100", move |bh| { - bh.iter(|| test::black_box(QR::new(m.clone()))) + bh.iter(|| std::hint::black_box(QR::new(m.clone()))) }); } fn qr_decompose_500x500(bh: &mut criterion::Criterion) { let m = DMatrix::::new_random(500, 500); bh.bench_function("qr_decompose_500x500", move |bh| { - bh.iter(|| test::black_box(QR::new(m.clone()))) + bh.iter(|| std::hint::black_box(QR::new(m.clone()))) }); } @@ -121,7 +121,7 @@ fn qr_inverse_10x10(bh: &mut criterion::Criterion) { let qr = QR::new(m.clone()); bh.bench_function("qr_inverse_10x10", move |bh| { - bh.iter(|| test::black_box(qr.try_inverse())) + bh.iter(|| std::hint::black_box(qr.try_inverse())) }); } @@ -130,7 +130,7 @@ fn qr_inverse_100x100(bh: &mut criterion::Criterion) { let qr = QR::new(m.clone()); bh.bench_function("qr_inverse_100x100", move |bh| { - bh.iter(|| test::black_box(qr.try_inverse())) + bh.iter(|| std::hint::black_box(qr.try_inverse())) }); } @@ -139,7 +139,7 @@ fn qr_inverse_500x500(bh: &mut criterion::Criterion) { let qr = QR::new(m.clone()); bh.bench_function("qr_inverse_500x500", move |bh| { - bh.iter(|| test::black_box(qr.try_inverse())) + bh.iter(|| std::hint::black_box(qr.try_inverse())) }); } diff --git a/benches/linalg/schur.rs b/benches/linalg/schur.rs index e4193a25..2014f145 100644 --- a/benches/linalg/schur.rs +++ b/benches/linalg/schur.rs @@ -3,56 +3,56 @@ use na::{Matrix4, Schur}; fn schur_decompose_4x4(bh: &mut criterion::Criterion) { let m = Matrix4::::new_random(); bh.bench_function("schur_decompose_4x4", move |bh| { - bh.iter(|| test::black_box(Schur::new(m.clone()))) + bh.iter(|| std::hint::black_box(Schur::new(m.clone()))) }); } fn schur_decompose_10x10(bh: &mut criterion::Criterion) { let m = crate::reproductible_dmatrix(10, 10); bh.bench_function("schur_decompose_10x10", move |bh| { - bh.iter(|| test::black_box(Schur::new(m.clone()))) + bh.iter(|| std::hint::black_box(Schur::new(m.clone()))) }); } fn schur_decompose_100x100(bh: &mut criterion::Criterion) { let m = crate::reproductible_dmatrix(100, 100); bh.bench_function("schur_decompose_100x100", move |bh| { - bh.iter(|| test::black_box(Schur::new(m.clone()))) + bh.iter(|| std::hint::black_box(Schur::new(m.clone()))) }); } fn schur_decompose_200x200(bh: &mut criterion::Criterion) { let m = crate::reproductible_dmatrix(200, 200); bh.bench_function("schur_decompose_200x200", move |bh| { - bh.iter(|| test::black_box(Schur::new(m.clone()))) + bh.iter(|| std::hint::black_box(Schur::new(m.clone()))) }); } fn eigenvalues_4x4(bh: &mut criterion::Criterion) { let m = Matrix4::::new_random(); bh.bench_function("eigenvalues_4x4", move |bh| { - bh.iter(|| test::black_box(m.complex_eigenvalues())) + bh.iter(|| std::hint::black_box(m.complex_eigenvalues())) }); } fn eigenvalues_10x10(bh: &mut criterion::Criterion) { let m = crate::reproductible_dmatrix(10, 10); bh.bench_function("eigenvalues_10x10", move |bh| { - bh.iter(|| test::black_box(m.complex_eigenvalues())) + bh.iter(|| std::hint::black_box(m.complex_eigenvalues())) }); } fn eigenvalues_100x100(bh: &mut criterion::Criterion) { let m = crate::reproductible_dmatrix(100, 100); bh.bench_function("eigenvalues_100x100", move |bh| { - bh.iter(|| test::black_box(m.complex_eigenvalues())) + bh.iter(|| std::hint::black_box(m.complex_eigenvalues())) }); } fn eigenvalues_200x200(bh: &mut criterion::Criterion) { let m = crate::reproductible_dmatrix(200, 200); bh.bench_function("eigenvalues_200x200", move |bh| { - bh.iter(|| test::black_box(m.complex_eigenvalues())) + bh.iter(|| std::hint::black_box(m.complex_eigenvalues())) }); } diff --git a/benches/linalg/svd.rs b/benches/linalg/svd.rs index aec18fd8..b84f60d6 100644 --- a/benches/linalg/svd.rs +++ b/benches/linalg/svd.rs @@ -3,112 +3,112 @@ use na::{Matrix4, SVD}; fn svd_decompose_4x4(bh: &mut criterion::Criterion) { let m = Matrix4::::new_random(); bh.bench_function("svd_decompose_4x4", move |bh| { - bh.iter(|| test::black_box(SVD::new(m.clone(), true, true))) + bh.iter(|| std::hint::black_box(SVD::new(m.clone(), true, true))) }); } fn svd_decompose_10x10(bh: &mut criterion::Criterion) { let m = crate::reproductible_dmatrix(10, 10); bh.bench_function("svd_decompose_10x10", move |bh| { - bh.iter(|| test::black_box(SVD::new(m.clone(), true, true))) + bh.iter(|| std::hint::black_box(SVD::new(m.clone(), true, true))) }); } fn svd_decompose_100x100(bh: &mut criterion::Criterion) { let m = crate::reproductible_dmatrix(100, 100); bh.bench_function("svd_decompose_100x100", move |bh| { - bh.iter(|| test::black_box(SVD::new(m.clone(), true, true))) + bh.iter(|| std::hint::black_box(SVD::new(m.clone(), true, true))) }); } fn svd_decompose_200x200(bh: &mut criterion::Criterion) { let m = crate::reproductible_dmatrix(200, 200); bh.bench_function("svd_decompose_200x200", move |bh| { - bh.iter(|| test::black_box(SVD::new(m.clone(), true, true))) + bh.iter(|| std::hint::black_box(SVD::new(m.clone(), true, true))) }); } fn rank_4x4(bh: &mut criterion::Criterion) { let m = Matrix4::::new_random(); bh.bench_function("rank_4x4", move |bh| { - bh.iter(|| test::black_box(m.rank(1.0e-10))) + bh.iter(|| std::hint::black_box(m.rank(1.0e-10))) }); } fn rank_10x10(bh: &mut criterion::Criterion) { let m = crate::reproductible_dmatrix(10, 10); bh.bench_function("rank_10x10", move |bh| { - bh.iter(|| test::black_box(m.rank(1.0e-10))) + bh.iter(|| std::hint::black_box(m.rank(1.0e-10))) }); } fn rank_100x100(bh: &mut criterion::Criterion) { let m = crate::reproductible_dmatrix(100, 100); bh.bench_function("rank_100x100", move |bh| { - bh.iter(|| test::black_box(m.rank(1.0e-10))) + bh.iter(|| std::hint::black_box(m.rank(1.0e-10))) }); } fn rank_200x200(bh: &mut criterion::Criterion) { let m = crate::reproductible_dmatrix(200, 200); bh.bench_function("rank_200x200", move |bh| { - bh.iter(|| test::black_box(m.rank(1.0e-10))) + bh.iter(|| std::hint::black_box(m.rank(1.0e-10))) }); } fn singular_values_4x4(bh: &mut criterion::Criterion) { let m = Matrix4::::new_random(); bh.bench_function("singular_values_4x4", move |bh| { - bh.iter(|| test::black_box(m.singular_values())) + bh.iter(|| std::hint::black_box(m.singular_values())) }); } fn singular_values_10x10(bh: &mut criterion::Criterion) { let m = crate::reproductible_dmatrix(10, 10); bh.bench_function("singular_values_10x10", move |bh| { - bh.iter(|| test::black_box(m.singular_values())) + bh.iter(|| std::hint::black_box(m.singular_values())) }); } fn singular_values_100x100(bh: &mut criterion::Criterion) { let m = crate::reproductible_dmatrix(100, 100); bh.bench_function("singular_values_100x100", move |bh| { - bh.iter(|| test::black_box(m.singular_values())) + bh.iter(|| std::hint::black_box(m.singular_values())) }); } fn singular_values_200x200(bh: &mut criterion::Criterion) { let m = crate::reproductible_dmatrix(200, 200); bh.bench_function("singular_values_200x200", move |bh| { - bh.iter(|| test::black_box(m.singular_values())) + bh.iter(|| std::hint::black_box(m.singular_values())) }); } fn pseudo_inverse_4x4(bh: &mut criterion::Criterion) { let m = Matrix4::::new_random(); bh.bench_function("pseudo_inverse_4x4", move |bh| { - bh.iter(|| test::black_box(m.clone().pseudo_inverse(1.0e-10))) + bh.iter(|| std::hint::black_box(m.clone().pseudo_inverse(1.0e-10))) }); } fn pseudo_inverse_10x10(bh: &mut criterion::Criterion) { let m = crate::reproductible_dmatrix(10, 10); bh.bench_function("pseudo_inverse_10x10", move |bh| { - bh.iter(|| test::black_box(m.clone().pseudo_inverse(1.0e-10))) + bh.iter(|| std::hint::black_box(m.clone().pseudo_inverse(1.0e-10))) }); } fn pseudo_inverse_100x100(bh: &mut criterion::Criterion) { let m = crate::reproductible_dmatrix(100, 100); bh.bench_function("pseudo_inverse_100x100", move |bh| { - bh.iter(|| test::black_box(m.clone().pseudo_inverse(1.0e-10))) + bh.iter(|| std::hint::black_box(m.clone().pseudo_inverse(1.0e-10))) }); } fn pseudo_inverse_200x200(bh: &mut criterion::Criterion) { let m = crate::reproductible_dmatrix(200, 200); bh.bench_function("pseudo_inverse_200x200", move |bh| { - bh.iter(|| test::black_box(m.clone().pseudo_inverse(1.0e-10))) + bh.iter(|| std::hint::black_box(m.clone().pseudo_inverse(1.0e-10))) }); } diff --git a/benches/linalg/symmetric_eigen.rs b/benches/linalg/symmetric_eigen.rs index 3b52ba5c..07ecc2a2 100644 --- a/benches/linalg/symmetric_eigen.rs +++ b/benches/linalg/symmetric_eigen.rs @@ -3,28 +3,28 @@ use na::{Matrix4, SymmetricEigen}; fn symmetric_eigen_decompose_4x4(bh: &mut criterion::Criterion) { let m = Matrix4::::new_random(); bh.bench_function("symmetric_eigen_decompose_4x4", move |bh| { - bh.iter(|| test::black_box(SymmetricEigen::new(m.clone()))) + bh.iter(|| std::hint::black_box(SymmetricEigen::new(m.clone()))) }); } fn symmetric_eigen_decompose_10x10(bh: &mut criterion::Criterion) { let m = crate::reproductible_dmatrix(10, 10); bh.bench_function("symmetric_eigen_decompose_10x10", move |bh| { - bh.iter(|| test::black_box(SymmetricEigen::new(m.clone()))) + bh.iter(|| std::hint::black_box(SymmetricEigen::new(m.clone()))) }); } fn symmetric_eigen_decompose_100x100(bh: &mut criterion::Criterion) { let m = crate::reproductible_dmatrix(100, 100); bh.bench_function("symmetric_eigen_decompose_100x100", move |bh| { - bh.iter(|| test::black_box(SymmetricEigen::new(m.clone()))) + bh.iter(|| std::hint::black_box(SymmetricEigen::new(m.clone()))) }); } fn symmetric_eigen_decompose_200x200(bh: &mut criterion::Criterion) { let m = crate::reproductible_dmatrix(200, 200); bh.bench_function("symmetric_eigen_decompose_200x200", move |bh| { - bh.iter(|| test::black_box(SymmetricEigen::new(m.clone()))) + bh.iter(|| std::hint::black_box(SymmetricEigen::new(m.clone()))) }); } diff --git a/nalgebra-lapack/benches/linalg/hessenberg.rs b/nalgebra-lapack/benches/linalg/hessenberg.rs index d62c221c..6a1de81e 100644 --- a/nalgebra-lapack/benches/linalg/hessenberg.rs +++ b/nalgebra-lapack/benches/linalg/hessenberg.rs @@ -5,17 +5,17 @@ use test::{self, Bencher}; #[bench] fn hessenberg_decompose_100x100(bh: &mut Bencher) { let m = DMatrix::::new_random(100, 100); - bh.iter(|| test::black_box(Hessenberg::new(m.clone()))) + bh.iter(|| std::hint::black_box(Hessenberg::new(m.clone()))) } #[bench] fn hessenberg_decompose_4x4(bh: &mut Bencher) { let m = Matrix4::::new_random(); - bh.iter(|| test::black_box(Hessenberg::new(m.clone()))) + bh.iter(|| std::hint::black_box(Hessenberg::new(m.clone()))) } #[bench] fn hessenberg_decompose_500x500(bh: &mut Bencher) { let m = DMatrix::::new_random(500, 500); - bh.iter(|| test::black_box(Hessenberg::new(m.clone()))) + bh.iter(|| std::hint::black_box(Hessenberg::new(m.clone()))) } diff --git a/nalgebra-lapack/benches/linalg/lu.rs b/nalgebra-lapack/benches/linalg/lu.rs index 4afd9003..4f33c757 100644 --- a/nalgebra-lapack/benches/linalg/lu.rs +++ b/nalgebra-lapack/benches/linalg/lu.rs @@ -5,29 +5,29 @@ use test::{self, Bencher}; #[bench] fn lu_decompose_100x100(bh: &mut Bencher) { let m = DMatrix::::new_random(100, 100); - bh.iter(|| test::black_box(LU::new(m.clone()))) + bh.iter(|| std::hint::black_box(LU::new(m.clone()))) } #[bench] fn lu_decompose_100x500(bh: &mut Bencher) { let m = DMatrix::::new_random(100, 500); - bh.iter(|| test::black_box(LU::new(m.clone()))) + bh.iter(|| std::hint::black_box(LU::new(m.clone()))) } #[bench] fn lu_decompose_4x4(bh: &mut Bencher) { let m = Matrix4::::new_random(); - bh.iter(|| test::black_box(LU::new(m.clone()))) + bh.iter(|| std::hint::black_box(LU::new(m.clone()))) } #[bench] fn lu_decompose_500x100(bh: &mut Bencher) { let m = DMatrix::::new_random(500, 100); - bh.iter(|| test::black_box(LU::new(m.clone()))) + bh.iter(|| std::hint::black_box(LU::new(m.clone()))) } #[bench] fn lu_decompose_500x500(bh: &mut Bencher) { let m = DMatrix::::new_random(500, 500); - bh.iter(|| test::black_box(LU::new(m.clone()))) + bh.iter(|| std::hint::black_box(LU::new(m.clone()))) } diff --git a/nalgebra-lapack/benches/linalg/qr.rs b/nalgebra-lapack/benches/linalg/qr.rs index c473e6f5..6e74fc52 100644 --- a/nalgebra-lapack/benches/linalg/qr.rs +++ b/nalgebra-lapack/benches/linalg/qr.rs @@ -5,29 +5,29 @@ use test::{self, Bencher}; #[bench] fn qr_decompose_100x100(bh: &mut Bencher) { let m = DMatrix::::new_random(100, 100); - bh.iter(|| test::black_box(QR::new(m.clone()))) + bh.iter(|| std::hint::black_box(QR::new(m.clone()))) } #[bench] fn qr_decompose_100x500(bh: &mut Bencher) { let m = DMatrix::::new_random(100, 500); - bh.iter(|| test::black_box(QR::new(m.clone()))) + bh.iter(|| std::hint::black_box(QR::new(m.clone()))) } #[bench] fn qr_decompose_4x4(bh: &mut Bencher) { let m = Matrix4::::new_random(); - bh.iter(|| test::black_box(QR::new(m.clone()))) + bh.iter(|| std::hint::black_box(QR::new(m.clone()))) } #[bench] fn qr_decompose_500x100(bh: &mut Bencher) { let m = DMatrix::::new_random(500, 100); - bh.iter(|| test::black_box(QR::new(m.clone()))) + bh.iter(|| std::hint::black_box(QR::new(m.clone()))) } #[bench] fn qr_decompose_500x500(bh: &mut Bencher) { let m = DMatrix::::new_random(500, 500); - bh.iter(|| test::black_box(QR::new(m.clone()))) + bh.iter(|| std::hint::black_box(QR::new(m.clone()))) }