Skip to content

Commit beccf96

Browse files
author
Raghuveer Devulapalli
committed
Add more float benchmarks
1 parent 4b5bdf3 commit beccf96

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

benchmarks/bench-objsort.hpp

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ struct Point3D {
2626
return std::sqrt(x * x + y * y + z * z);
2727
}
2828
else if constexpr (name == "taxicab") {
29-
return abs(x) + abs(y) + abs(z);
29+
return std::abs(x) + std::abs(y) + std::abs(z);
3030
}
3131
else if constexpr (name == "chebyshev") {
3232
return std::max(std::max(x, y), z);
@@ -98,13 +98,15 @@ static void simdobjsort(benchmark::State &state)
9898
->Arg(10e5) \
9999
->Arg(10e6);
100100

101-
BENCHMARK_OBJSORT(simdobjsort, Point3D, double, x)
102-
BENCHMARK_OBJSORT(scalarobjsort, Point3D, double, x)
103-
BENCHMARK_OBJSORT(simdobjsort, Point3D, float, x)
104-
BENCHMARK_OBJSORT(scalarobjsort, Point3D, float, x)
105-
BENCHMARK_OBJSORT(simdobjsort, Point3D, double, taxicab )
106-
BENCHMARK_OBJSORT(scalarobjsort, Point3D, double, taxicab)
107-
BENCHMARK_OBJSORT(simdobjsort, Point3D, double, euclidean)
108-
BENCHMARK_OBJSORT(scalarobjsort, Point3D, double, euclidean)
109-
BENCHMARK_OBJSORT(simdobjsort, Point3D, double, chebyshev)
110-
BENCHMARK_OBJSORT(scalarobjsort, Point3D, double, chebyshev)
101+
#define BENCH_ALL(dtype) \
102+
BENCHMARK_OBJSORT(simdobjsort, Point3D, dtype, x) \
103+
BENCHMARK_OBJSORT(scalarobjsort, Point3D, dtype, x) \
104+
BENCHMARK_OBJSORT(simdobjsort, Point3D, dtype, taxicab ) \
105+
BENCHMARK_OBJSORT(scalarobjsort, Point3D, dtype, taxicab) \
106+
BENCHMARK_OBJSORT(simdobjsort, Point3D, dtype, euclidean) \
107+
BENCHMARK_OBJSORT(scalarobjsort, Point3D, dtype, euclidean) \
108+
BENCHMARK_OBJSORT(simdobjsort, Point3D, dtype, chebyshev) \
109+
BENCHMARK_OBJSORT(scalarobjsort, Point3D, dtype, chebyshev) \
110+
111+
BENCH_ALL(double)
112+
BENCH_ALL(float)

0 commit comments

Comments
 (0)