test: freepipe
This commit is contained in:
parent
4d37acdda7
commit
bd8e17b2ab
@ -3,7 +3,7 @@ find_package(benchmark REQUIRED)
|
|||||||
add_executable(pipeline.test pipeline.test.cpp)
|
add_executable(pipeline.test pipeline.test.cpp)
|
||||||
target_compile_features(pipeline.test PUBLIC cxx_std_23)
|
target_compile_features(pipeline.test PUBLIC cxx_std_23)
|
||||||
target_link_libraries(pipeline.test benchmark::benchmark_main
|
target_link_libraries(pipeline.test benchmark::benchmark_main
|
||||||
pipeline::pipeline joboccara::pipes)
|
pipeline::pipeline joboccara::pipes pipe)
|
||||||
add_test(NAME pipeline.test COMMAND pipeline.test)
|
add_test(NAME pipeline.test COMMAND pipeline.test)
|
||||||
|
|
||||||
find_package(GTest REQUIRED)
|
find_package(GTest REQUIRED)
|
||||||
|
|||||||
@ -1,7 +1,9 @@
|
|||||||
#include <benchmark/benchmark.h>
|
#include <benchmark/benchmark.h>
|
||||||
|
|
||||||
|
#include <freepipe/freepipe.hpp>
|
||||||
#include <pipeline/pipeline.hpp>
|
#include <pipeline/pipeline.hpp>
|
||||||
#include <pipes/pipes.hpp>
|
#include <pipes/pipes.hpp>
|
||||||
|
#include <tuple>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@ -37,19 +39,40 @@ void BM_Pipes(benchmark::State& state) {
|
|||||||
}
|
}
|
||||||
BENCHMARK(BM_Pipes);
|
BENCHMARK(BM_Pipes);
|
||||||
|
|
||||||
|
void BM_Pipe(benchmark::State &state) {
|
||||||
|
using namespace freepipe;
|
||||||
|
|
||||||
|
for (auto _ : state) {
|
||||||
|
const Pipe p;
|
||||||
|
|
||||||
|
auto r = p | [] { return std::tuple{0, 1}; } | [](auto ab) {
|
||||||
|
auto a = std::get<0>(ab);
|
||||||
|
auto b = std::get<1>(ab);
|
||||||
|
|
||||||
|
return a + b;
|
||||||
|
} | [](auto a) {
|
||||||
|
return a * 2;
|
||||||
|
} | [](auto a) { return a * a; };
|
||||||
|
|
||||||
|
benchmark::DoNotOptimize(r);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
BENCHMARK(BM_Pipe);
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
// 2025-07-31T22:57:54+01:00
|
// 2025-08-06T21:13:50+01:00
|
||||||
// Running /home/murta/src/pipeline/build/tests/pipeline.test
|
// Running /home/murta/src/pipeline/build/tests/pipeline.test
|
||||||
// Run on (16 X 3200 MHz CPU s)
|
// Run on (16 X 3199.99 MHz CPU s)
|
||||||
// CPU Caches:
|
// CPU Caches:
|
||||||
// L1 Data 32 KiB (x8)
|
// L1 Data 32 KiB (x8)
|
||||||
// L1 Instruction 64 KiB (x8)
|
// L1 Instruction 64 KiB (x8)
|
||||||
// L2 Unified 512 KiB (x8)
|
// L2 Unified 512 KiB (x8)
|
||||||
// L3 Unified 8192 KiB (x2)
|
// L3 Unified 8192 KiB (x2)
|
||||||
// Load Average: 0.42, 0.47, 0.40
|
// Load Average: 1.68, 1.49, 0.97
|
||||||
// ------------------------------------------------------
|
// -------------------------------------------------------
|
||||||
// Benchmark Time CPU Iterations
|
// Benchmark Time CPU Iterations
|
||||||
// ------------------------------------------------------
|
// -------------------------------------------------------
|
||||||
// BM_Pipeline 0.340 ns 0.340 ns 2065571679
|
// BM_Pipeline 0.323 ns 0.323 ns 2163778209
|
||||||
// BM_Pipes 13.3 ns 13.3 ns 54185576
|
// BM_Pipes 12.2 ns 12.2 ns 57225038
|
||||||
|
// BM_Pipe 0.320 ns 0.320 ns 2173384108
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user