Closed jagerman closed 2 years ago
This currently allows approximately 30% better throughput on tiny jobs (when the proxy thread is the bottleneck).
Broken down commit-by-commit.
Testing using:
#include <oxenmq/oxenmq.h> #include <chrono> std::atomic<int64_t> did{0}; using namespace std::literals; int main() { constexpr auto target_jobs = 2'000'000; oxenmq::OxenMQ omq; omq.set_general_threads(4); omq.start(); auto start = std::chrono::system_clock::now(); while (true) { int64_t target = did + 1000; for (int i = 0; i < 1000; i++) { omq.job([] { did++; }); } while (did < target) std::this_thread::sleep_for(1ms); if (target >= target_jobs) break; } std::chrono::duration<double> elapsed{std::chrono::system_clock::now() - start}; std::cout << "Elapsed: " << elapsed.count() << " for " << target_jobs << " jobs (" << (target_jobs / elapsed.count()) << "/s)\n"; }
This currently allows approximately 30% better throughput on tiny jobs (when the proxy thread is the bottleneck).
Broken down commit-by-commit.
Testing using: