diff options
author | Niall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com> | 2021-02-24 14:36:30 +0300 |
---|---|---|
committer | Niall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com> | 2021-03-16 13:21:44 +0300 |
commit | 37e0fd29adb4e1345eb8ca4893cb5f71210e2ea5 (patch) | |
tree | b082c81ac8587794ca5d15fdcf894c297bcd0a7b /programs | |
parent | 6e67c32bd0e469c6823a33a83677694b3dcdae30 (diff) |
Add benchmark results for GCD on Linux, Win32 thread pools on Windows, and ASIO on both Linux and Windows. My native implementation is overcreating threads currently, so not worth recording those yet.
Diffstat (limited to 'programs')
-rw-r--r-- | programs/benchmark-dynamic_thread_pool_group/main.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/programs/benchmark-dynamic_thread_pool_group/main.cpp b/programs/benchmark-dynamic_thread_pool_group/main.cpp index 936bc622..841fcacf 100644 --- a/programs/benchmark-dynamic_thread_pool_group/main.cpp +++ b/programs/benchmark-dynamic_thread_pool_group/main.cpp @@ -23,7 +23,7 @@ Distributed under the Boost Software License, Version 1.0. */ //! Seconds to run the benchmark -static constexpr unsigned BENCHMARK_DURATION = 5; +static constexpr unsigned BENCHMARK_DURATION = 10; //! Maximum work items to create static constexpr unsigned MAX_WORK_ITEMS = 1024; @@ -124,11 +124,11 @@ struct asio_runner } } }; - template <class F> void add_workitem(F &&f) { ctx.post(C(this, std::move(f))); } + template <class F> void add_workitem(F &&f) { ctx.post(C<F>(this, std::move(f))); } std::chrono::microseconds run(unsigned seconds) { std::vector<std::thread> threads; - for(size_t n = 0; n < std::thread::hardware_concurrency(); n++) + for(size_t n = 0; n < std::thread::hardware_concurrency() * 2; n++) { threads.emplace_back([&] { ctx.run(); }); } @@ -156,7 +156,7 @@ template <class Runner> void benchmark(const char *name) struct worker { shared_t *shared; - char buffer[4096]; + char buffer[65536]; QUICKCPPLIB_NAMESPACE::algorithm::hash::sha256_hash::result_type hash; uint64_t count{0}; @@ -218,10 +218,13 @@ template <class Runner> void benchmark(const char *name) int main(void) { - benchmark<llfio_runner>("llfio"); + std::string llfio_name("llfio ("); + llfio_name.append(llfio::dynamic_thread_pool_group::implementation_description()); + llfio_name.push_back(')'); + benchmark<llfio_runner>(llfio_name.c_str()); + #if ENABLE_ASIO benchmark<asio_runner>("asio"); #endif - return 0; }
\ No newline at end of file |