From b5960ebbe7236eef62620b0a07df8de93dffc81e Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 17 Mar 2017 16:57:49 +0200 Subject: Shorten scheduler queue depth, make it customizable via command line --- build2/scheduler.cxx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'build2/scheduler.cxx') diff --git a/build2/scheduler.cxx b/build2/scheduler.cxx index 05816b8..9a3003b 100644 --- a/build2/scheduler.cxx +++ b/build2/scheduler.cxx @@ -255,12 +255,17 @@ namespace build2 max_threads_ = max_threads; // This value should be proportional to the amount of hardware concurrency - // we have (no use queing things if helpers cannot keep up). Note that the - // queue entry is quite sizable. + // we have (no use queing things up if helpers cannot keep up). Note that + // the queue entry is quite sizable. + // + // The relationship is as follows: we want to have a deeper queue if the + // tasks take long (e.g., compilation) and shorter if they are quick (e.g, + // test execution). If the tasks are quick then the synchronization + // overhead required for queuing/dequeuing things starts to dominate. // task_queue_depth_ = queue_depth != 0 ? queue_depth - : max_active * sizeof (void*) * 4; + : max_active * 4; queued_task_count_.store (0, memory_order_relaxed); -- cgit v1.1