diff --git a/benchmark/benchmark_mat.cpp b/benchmark/benchmark_mat.cpp index 85d303e..f2eda9a 100644 --- a/benchmark/benchmark_mat.cpp +++ b/benchmark/benchmark_mat.cpp @@ -5,12 +5,10 @@ #include #include -#include - using namespace omath; -void mat_multiplication(benchmark::State& state) +void mat_float_multiplication_col_major(benchmark::State& state) { using MatType = Mat<128, 128, float, MatStoreType::COLUMN_MAJOR>; MatType a; @@ -20,10 +18,49 @@ void mat_multiplication(benchmark::State& state) for (auto _ : state) - { std::ignore = a * b; - } +} +void mat_float_multiplication_row_major(benchmark::State& state) +{ + using MatType = Mat<128, 128, float, MatStoreType::ROW_MAJOR>; + MatType a; + MatType b; + a.set(3.f); + b.set(7.f); + + + for (auto _ : state) + std::ignore = a * b; } -BENCHMARK(mat_multiplication); -BENCHMARK_MAIN(); \ No newline at end of file +void mat_double_multiplication_row_major(benchmark::State& state) +{ + using MatType = Mat<128, 128, double, MatStoreType::ROW_MAJOR>; + MatType a; + MatType b; + a.set(3.f); + b.set(7.f); + + + for (auto _ : state) + std::ignore = a * b; +} + +void mat_double_multiplication_col_major(benchmark::State& state) +{ + using MatType = Mat<128, 128, double, MatStoreType::COLUMN_MAJOR>; + MatType a; + MatType b; + a.set(3.f); + b.set(7.f); + + + for (auto _ : state) + std::ignore = a * b; +} + +BENCHMARK(mat_float_multiplication_col_major)->Iterations(5000); +BENCHMARK(mat_float_multiplication_row_major)->Iterations(5000); + +BENCHMARK(mat_double_multiplication_col_major)->Iterations(5000); +BENCHMARK(mat_double_multiplication_row_major)->Iterations(5000); \ No newline at end of file diff --git a/benchmark/main.cpp b/benchmark/main.cpp new file mode 100644 index 0000000..790aeae --- /dev/null +++ b/benchmark/main.cpp @@ -0,0 +1,5 @@ +// +// Created by Vlad on 9/17/2025. +// +#include +BENCHMARK_MAIN(); \ No newline at end of file