From 0782e4dd5ddb13166ef20f95eeda878128c69654 Mon Sep 17 00:00:00 2001 From: sbstndb/sbstndbs Date: Thu, 24 Apr 2025 21:34:40 +0200 Subject: [PATCH] fix: update benchmarks - Update include paths for the benchmarks - Comment one benchmark that do not longer compiles. Do not forget to repair it in the future. --- benchmark/benchmark_adapter.cpp | 10 ++--- benchmark/benchmark_assign.cpp | 6 +-- benchmark/benchmark_builder.cpp | 6 +-- benchmark/benchmark_container.cpp | 4 +- benchmark/benchmark_creation.cpp | 8 ++-- benchmark/benchmark_increment_stepper.cpp | 4 +- benchmark/benchmark_lambda_expressions.cpp | 10 ++--- benchmark/benchmark_math.cpp | 6 +-- benchmark/benchmark_random.cpp | 8 ++-- benchmark/benchmark_reducer.cpp | 4 +- benchmark/benchmark_view_access.cpp | 16 ++++---- benchmark/benchmark_view_adapt.cpp | 12 +++--- benchmark/benchmark_view_assignment.cpp | 47 +++++++++++----------- benchmark/benchmark_views.cpp | 14 +++---- benchmark/benchmark_xshape.cpp | 4 +- benchmark/main.cpp | 4 +- 16 files changed, 82 insertions(+), 81 deletions(-) diff --git a/benchmark/benchmark_adapter.cpp b/benchmark/benchmark_adapter.cpp index c1f6f19c5..3a76dcb7e 100644 --- a/benchmark/benchmark_adapter.cpp +++ b/benchmark/benchmark_adapter.cpp @@ -8,11 +8,11 @@ #include -// #include "xtensor/xshape.hpp" -#include "xtensor/xadapt.hpp" -#include "xtensor/xnoalias.hpp" -#include "xtensor/xstorage.hpp" -#include "xtensor/xutils.hpp" +// #include "xtensor/core/core/xshape.hpp" +#include "xtensor/containers/xadapt.hpp" +#include "xtensor/containers/xstorage.hpp" +#include "xtensor/core/xnoalias.hpp" +#include "xtensor/utils/xutils.hpp" namespace xt { diff --git a/benchmark/benchmark_assign.cpp b/benchmark/benchmark_assign.cpp index 9f44a7458..b9efb341e 100644 --- a/benchmark/benchmark_assign.cpp +++ b/benchmark/benchmark_assign.cpp @@ -11,9 +11,9 @@ #include -#include "xtensor/xarray.hpp" -#include "xtensor/xnoalias.hpp" -#include "xtensor/xtensor.hpp" +#include "xtensor/containers/xarray.hpp" +#include "xtensor/containers/xtensor.hpp" +#include "xtensor/core/xnoalias.hpp" namespace xt { diff --git a/benchmark/benchmark_builder.cpp b/benchmark/benchmark_builder.cpp index 1b49d0d59..e25de39cb 100644 --- a/benchmark/benchmark_builder.cpp +++ b/benchmark/benchmark_builder.cpp @@ -8,9 +8,9 @@ #include -#include "xtensor/xarray.hpp" -#include "xtensor/xnoalias.hpp" -#include "xtensor/xtensor.hpp" +#include "xtensor/containers/xarray.hpp" +#include "xtensor/containers/xtensor.hpp" +#include "xtensor/core/xnoalias.hpp" namespace xt { diff --git a/benchmark/benchmark_container.cpp b/benchmark/benchmark_container.cpp index 2b85e279a..af51d1d19 100644 --- a/benchmark/benchmark_container.cpp +++ b/benchmark/benchmark_container.cpp @@ -12,8 +12,8 @@ #include -#include "xtensor/xarray.hpp" -#include "xtensor/xtensor.hpp" +#include "xtensor/containers/xarray.hpp" +#include "xtensor/containers/xtensor.hpp" namespace xt { diff --git a/benchmark/benchmark_creation.cpp b/benchmark/benchmark_creation.cpp index 0e4b0a18e..4410d2325 100644 --- a/benchmark/benchmark_creation.cpp +++ b/benchmark/benchmark_creation.cpp @@ -8,10 +8,10 @@ #include -#include "xtensor/xarray.hpp" -#include "xtensor/xbuilder.hpp" -#include "xtensor/xfixed.hpp" -#include "xtensor/xtensor.hpp" +#include "xtensor/containers/xarray.hpp" +#include "xtensor/containers/xfixed.hpp" +#include "xtensor/containers/xtensor.hpp" +#include "xtensor/generators/xbuilder.hpp" namespace xt { diff --git a/benchmark/benchmark_increment_stepper.cpp b/benchmark/benchmark_increment_stepper.cpp index cc0256fd9..1557692e2 100644 --- a/benchmark/benchmark_increment_stepper.cpp +++ b/benchmark/benchmark_increment_stepper.cpp @@ -8,8 +8,8 @@ #include -#include "xtensor/xarray.hpp" -#include "xtensor/xrandom.hpp" +#include "xtensor/containers/xarray.hpp" +#include "xtensor/generators/xrandom.hpp" #define SHAPE 30, 30 #define RANGE 3, 100 diff --git a/benchmark/benchmark_lambda_expressions.cpp b/benchmark/benchmark_lambda_expressions.cpp index 3d9ff8cf3..6c6c40a49 100644 --- a/benchmark/benchmark_lambda_expressions.cpp +++ b/benchmark/benchmark_lambda_expressions.cpp @@ -8,11 +8,11 @@ #include -#include "xtensor/xarray.hpp" -#include "xtensor/xbuilder.hpp" -#include "xtensor/xmath.hpp" -#include "xtensor/xnoalias.hpp" -#include "xtensor/xtensor.hpp" +#include "xtensor/containers/xarray.hpp" +#include "xtensor/containers/xtensor.hpp" +#include "xtensor/core/xmath.hpp" +#include "xtensor/core/xnoalias.hpp" +#include "xtensor/generators/xbuilder.hpp" namespace xt { diff --git a/benchmark/benchmark_math.cpp b/benchmark/benchmark_math.cpp index 20fd0c726..c365551ea 100644 --- a/benchmark/benchmark_math.cpp +++ b/benchmark/benchmark_math.cpp @@ -13,9 +13,9 @@ #include -#include "xtensor/xarray.hpp" -#include "xtensor/xnoalias.hpp" -#include "xtensor/xtensor.hpp" +#include "xtensor/containers/xarray.hpp" +#include "xtensor/containers/xtensor.hpp" +#include "xtensor/core/xnoalias.hpp" // For how many sizes should math functions be tested? #define MATH_RANGE 64, 64 diff --git a/benchmark/benchmark_random.cpp b/benchmark/benchmark_random.cpp index 82e87104a..e5279988d 100644 --- a/benchmark/benchmark_random.cpp +++ b/benchmark/benchmark_random.cpp @@ -11,10 +11,10 @@ #include -#include "xtensor/xarray.hpp" -#include "xtensor/xnoalias.hpp" -#include "xtensor/xrandom.hpp" -#include "xtensor/xtensor.hpp" +#include "xtensor/containers/xarray.hpp" +#include "xtensor/containers/xtensor.hpp" +#include "xtensor/core/xnoalias.hpp" +#include "xtensor/generators/xrandom.hpp" namespace xt { diff --git a/benchmark/benchmark_reducer.cpp b/benchmark/benchmark_reducer.cpp index fe36a850f..c4304782f 100644 --- a/benchmark/benchmark_reducer.cpp +++ b/benchmark/benchmark_reducer.cpp @@ -8,8 +8,8 @@ #include -#include "xtensor/xarray.hpp" -#include "xtensor/xreducer.hpp" +#include "xtensor/containers/xarray.hpp" +#include "xtensor/reducers/xreducer.hpp" namespace xt { diff --git a/benchmark/benchmark_view_access.cpp b/benchmark/benchmark_view_access.cpp index 7fdb4d0a8..78569955e 100644 --- a/benchmark/benchmark_view_access.cpp +++ b/benchmark/benchmark_view_access.cpp @@ -8,14 +8,14 @@ #include -// #include "xtensor/xshape.hpp" -#include "xtensor/xadapt.hpp" -#include "xtensor/xbuilder.hpp" -#include "xtensor/xnoalias.hpp" -#include "xtensor/xrandom.hpp" -#include "xtensor/xstorage.hpp" -#include "xtensor/xutils.hpp" -#include "xtensor/xview.hpp" +// #include "xtensor/core/core/xshape.hpp" +#include "xtensor/containers/xadapt.hpp" +#include "xtensor/containers/xstorage.hpp" +#include "xtensor/core/xnoalias.hpp" +#include "xtensor/generators/xbuilder.hpp" +#include "xtensor/generators/xrandom.hpp" +#include "xtensor/utils/xutils.hpp" +#include "xtensor/views/xview.hpp" namespace xt { diff --git a/benchmark/benchmark_view_adapt.cpp b/benchmark/benchmark_view_adapt.cpp index e5059f7b3..2523cb725 100644 --- a/benchmark/benchmark_view_adapt.cpp +++ b/benchmark/benchmark_view_adapt.cpp @@ -11,12 +11,12 @@ #include -#include "xtensor/xadapt.hpp" -#include "xtensor/xfixed.hpp" -#include "xtensor/xnoalias.hpp" -#include "xtensor/xrandom.hpp" -#include "xtensor/xtensor.hpp" -#include "xtensor/xview.hpp" +#include "xtensor/containers/xadapt.hpp" +#include "xtensor/containers/xfixed.hpp" +#include "xtensor/containers/xtensor.hpp" +#include "xtensor/core/xnoalias.hpp" +#include "xtensor/generators/xrandom.hpp" +#include "xtensor/views/xview.hpp" namespace xt { diff --git a/benchmark/benchmark_view_assignment.cpp b/benchmark/benchmark_view_assignment.cpp index 2bfd5f5cf..4914d161f 100644 --- a/benchmark/benchmark_view_assignment.cpp +++ b/benchmark/benchmark_view_assignment.cpp @@ -8,11 +8,11 @@ #include -#include "xtensor/xarray.hpp" -#include "xtensor/xfixed.hpp" -#include "xtensor/xnoalias.hpp" -#include "xtensor/xrandom.hpp" -#include "xtensor/xtensor.hpp" +#include "xtensor/containers/xarray.hpp" +#include "xtensor/containers/xfixed.hpp" +#include "xtensor/containers/xtensor.hpp" +#include "xtensor/core/xnoalias.hpp" +#include "xtensor/generators/xrandom.hpp" namespace xt { @@ -61,23 +61,24 @@ namespace xt } } - inline void assign_create_strided_view(benchmark::State& state) - { - xt::xtensor tens = xt::random::rand({100, 100, 3, 3}); - for (auto _ : state) - { - for (std::size_t i = 0; i < tens.shape()[0]; ++i) - { - for (std::size_t j = 0; j < tens.shape()[1]; ++j) - { - auto v = xt::strided_view(tens, {i, j, all(), all()}); - xt::xtensor vas = v; - benchmark::ClobberMemory(); - } - } - } - } - + /** + * inline void assign_create_strided_view(benchmark::State& state) + * { + * xt::xtensor tens = xt::random::rand({100, 100, 3, 3}); + * for (auto _ : state) + * { + * for (std::size_t i = 0; i < tens.shape()[0]; ++i) + * { + * for (std::size_t j = 0; j < tens.shape()[1]; ++j) + * { + * auto v = xt::strided_view(tens, {i, j, all(), all()}); + * xt::xtensor vas = v; + * benchmark::ClobberMemory(); + * } + * } + * } + * } + */ inline void assign_create_manual_view(benchmark::State& state) { xt::xtensor tens = xt::random::rand({100, 100, 3, 3}); @@ -151,7 +152,7 @@ namespace xt BENCHMARK(create_strided_view_outofplace); BENCHMARK(create_strided_view_inplace); BENCHMARK(assign_create_manual_noview); - BENCHMARK(assign_create_strided_view); + // BENCHMARK(assign_create_strided_view); BENCHMARK(assign_create_view); BENCHMARK(assign_create_manual_view); BENCHMARK(data_offset); diff --git a/benchmark/benchmark_views.cpp b/benchmark/benchmark_views.cpp index db233ec05..f2c34d510 100644 --- a/benchmark/benchmark_views.cpp +++ b/benchmark/benchmark_views.cpp @@ -12,13 +12,13 @@ #include -#include "xtensor/xarray.hpp" -#include "xtensor/xmanipulation.hpp" -#include "xtensor/xnoalias.hpp" -#include "xtensor/xstrided_view.hpp" -#include "xtensor/xstrides.hpp" -#include "xtensor/xtensor.hpp" -#include "xtensor/xview.hpp" +#include "xtensor/containers/xarray.hpp" +#include "xtensor/containers/xtensor.hpp" +#include "xtensor/core/xnoalias.hpp" +#include "xtensor/core/xstrides.hpp" +#include "xtensor/misc/xmanipulation.hpp" +#include "xtensor/views/xstrided_view.hpp" +#include "xtensor/views/xview.hpp" namespace xt { diff --git a/benchmark/benchmark_xshape.cpp b/benchmark/benchmark_xshape.cpp index 9b6a8e6dd..6656b912f 100644 --- a/benchmark/benchmark_xshape.cpp +++ b/benchmark/benchmark_xshape.cpp @@ -12,8 +12,8 @@ #include -#include "xtensor/xshape.hpp" -#include "xtensor/xstorage.hpp" +#include "xtensor/containers/xstorage.hpp" +#include "xtensor/core/xshape.hpp" namespace xt { diff --git a/benchmark/main.cpp b/benchmark/main.cpp index 6444c0efb..39491c225 100644 --- a/benchmark/main.cpp +++ b/benchmark/main.cpp @@ -10,8 +10,8 @@ #include -#include "xtensor/xarray.hpp" -#include "xtensor/xtensor.hpp" +#include "xtensor/containers/xarray.hpp" +#include "xtensor/containers/xtensor.hpp" #ifdef XTENSOR_USE_XSIMD #ifdef __GNUC__