aboutsummaryrefslogtreecommitdiff
path: root/build2/scheduler.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-03-17 16:57:49 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-03-17 16:57:49 +0200
commitb5960ebbe7236eef62620b0a07df8de93dffc81e (patch)
treec95f4f54ca67a9886211d2c27b0a2a2fef5012e6 /build2/scheduler.cxx
parentfdb3931c1948fbf9d56c98165f411aa5abf1b02d (diff)
Shorten scheduler queue depth, make it customizable via command line
Diffstat (limited to 'build2/scheduler.cxx')
-rw-r--r--build2/scheduler.cxx11
1 files changed, 8 insertions, 3 deletions
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);