From 50a85a5dd6003b10e57ea65af21ebd0e469f429b Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Tue, 3 Jul 2018 23:47:48 +0000 Subject: [PATCH] style: Cap the number of style threads at six. Differential Revision: https://phabricator.services.mozilla.com/D1928 Bug: 1431285 Reviewed-by: emilio --- components/style/gecko/global_style_data.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/components/style/gecko/global_style_data.rs b/components/style/gecko/global_style_data.rs index f1cb107dff0f..6671de9867d2 100644 --- a/components/style/gecko/global_style_data.rs +++ b/components/style/gecko/global_style_data.rs @@ -65,7 +65,12 @@ lazy_static! { .map(|s| s.parse::().expect("invalid STYLO_THREADS value")); let mut num_threads = match stylo_threads { Ok(num) => num, - _ => cmp::max(num_cpus::get() * 3 / 4, 1), + // The default heuristic is num_virtual_cores * .75. This gives us + // three threads on a hyper-threaded dual core, and six threads on + // a hyper-threaded quad core. The performance benefit of additional + // threads seems to level off at around six, so we cap it there on + // many-core machines (see bug 1431285 comment 14). + _ => cmp::min(cmp::max(num_cpus::get() * 3 / 4, 1), 6), }; // If num_threads is one, there's no point in creating a thread pool, so