Only serialize GWT opt and dbg builds on systems with less than 8 CPUs
In change Icc1856c9 the compilation of the GWT opt and dbg components
was serialized to reduce the load on systems that have few CPU cores.
This has the side effect of extending the build time for systems that
have more cores.
Modify it to only serialize the compilations when the host system has
fewer than 8 CPUS.
On my Linux desktop with 8 CPU cores, this reduces the build time by
around 50 seconds.
Change-Id: I845dbfcc010c191c9a9fc42519235e1c8e329f51
diff --git a/gerrit-gwtui/BUCK b/gerrit-gwtui/BUCK
index aad5e0b..9eb0bf6 100644
--- a/gerrit-gwtui/BUCK
+++ b/gerrit-gwtui/BUCK
@@ -2,6 +2,7 @@
include_defs('//tools/gwt-constants.defs')
from multiprocessing import cpu_count
+CPU_COUNT = cpu_count()
DEPS = GWT_COMMON_DEPS + [
'//gerrit-gwtexpui:CSS',
'//lib:gwtjsonrpc',
@@ -29,8 +30,8 @@
name = 'ui_opt',
modules = [MODULE],
module_deps = [':ui_module'],
- deps = DEPS + [':ui_dbg'],
- local_workers = cpu_count(),
+ deps = DEPS + ([':ui_dbg'] if CPU_COUNT < 8 else []),
+ local_workers = CPU_COUNT,
strict = True,
experimental_args = GWT_COMPILER_ARGS,
vm_args = GWT_JVM_ARGS,
@@ -41,7 +42,7 @@
modules = [MODULE],
module_deps = [':ui_module'],
deps = DEPS + [':ui_dbg'],
- local_workers = cpu_count(),
+ local_workers = CPU_COUNT,
strict = True,
experimental_args = GWT_COMPILER_ARGS + ['-compileReport'],
vm_args = GWT_JVM_ARGS,
@@ -54,7 +55,7 @@
optimize = 0,
module_deps = [':ui_module'],
deps = DEPS,
- local_workers = cpu_count(),
+ local_workers = CPU_COUNT,
strict = True,
experimental_args = GWT_COMPILER_ARGS,
vm_args = GWT_JVM_ARGS,