Skip to content

Commit 8ba0551

Browse files
alugowskiPaul T
authored andcommitted
Add task_thread_pool to benchmarks
1 parent a9a1826 commit 8ba0551

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

benchmark/CMakeLists.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,19 @@ CPMAddPackage(
3636
GIT_SHALLOW
3737
)
3838

39+
CPMAddPackage(
40+
NAME task_thread_pool
41+
GITHUB_REPOSITORY alugowski/task_thread_pool
42+
VERSION 1.0.4
43+
GIT_SHALLOW
44+
)
45+
3946
# ---- Create binary ----
4047
file(GLOB sources CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/source/*.cpp)
4148
file(GLOB headers CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/include/*.h)
4249

4350
add_executable(${PROJECT_NAME} ${headers} ${sources})
44-
target_link_libraries(${PROJECT_NAME} nanobench doctest::doctest bshoshany RiftenThiefpool dp::thread-pool)
51+
target_link_libraries(${PROJECT_NAME} nanobench doctest::doctest bshoshany RiftenThiefpool dp::thread-pool task_thread_pool::task_thread_pool)
4552
set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 20)
4653
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
4754

benchmark/source/matrix_multiplication.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <fstream>
88
#include <future>
99
#include <riften/thiefpool.hpp>
10+
#include <task_thread_pool.hpp>
1011

1112
#include "utilities.h"
1213

@@ -112,6 +113,14 @@ TEST_CASE("matrix_multiplication") {
112113
});
113114
}
114115

116+
{
117+
task_thread_pool::task_thread_pool ttp{};
118+
run_benchmark<int>(&bench, array_size, iterations, "task_thread_pool",
119+
[&](const std::vector<int>& a, const std::vector<int>& b) -> void {
120+
ttp.submit_detach(thread_task, a, b);
121+
});
122+
}
123+
115124
{
116125
riften::Thiefpool riften_thiefpool{};
117126
run_benchmark<int>(&bench, array_size, iterations, "riften::Thiefpool",

0 commit comments

Comments
 (0)