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
This commit is contained in:
David Pursehouse 2015-04-08 13:37:57 +09:00
parent 5d3dfe2d63
commit 5b935aee59

View File

@ -2,6 +2,7 @@ include_defs('//gerrit-gwtui/gwt.defs')
include_defs('//tools/gwt-constants.defs') include_defs('//tools/gwt-constants.defs')
from multiprocessing import cpu_count from multiprocessing import cpu_count
CPU_COUNT = cpu_count()
DEPS = GWT_COMMON_DEPS + [ DEPS = GWT_COMMON_DEPS + [
'//gerrit-gwtexpui:CSS', '//gerrit-gwtexpui:CSS',
'//lib:gwtjsonrpc', '//lib:gwtjsonrpc',
@ -29,8 +30,8 @@ gwt_binary(
name = 'ui_opt', name = 'ui_opt',
modules = [MODULE], modules = [MODULE],
module_deps = [':ui_module'], module_deps = [':ui_module'],
deps = DEPS + [':ui_dbg'], deps = DEPS + ([':ui_dbg'] if CPU_COUNT < 8 else []),
local_workers = cpu_count(), local_workers = CPU_COUNT,
strict = True, strict = True,
experimental_args = GWT_COMPILER_ARGS, experimental_args = GWT_COMPILER_ARGS,
vm_args = GWT_JVM_ARGS, vm_args = GWT_JVM_ARGS,
@ -41,7 +42,7 @@ gwt_binary(
modules = [MODULE], modules = [MODULE],
module_deps = [':ui_module'], module_deps = [':ui_module'],
deps = DEPS + [':ui_dbg'], deps = DEPS + [':ui_dbg'],
local_workers = cpu_count(), local_workers = CPU_COUNT,
strict = True, strict = True,
experimental_args = GWT_COMPILER_ARGS + ['-compileReport'], experimental_args = GWT_COMPILER_ARGS + ['-compileReport'],
vm_args = GWT_JVM_ARGS, vm_args = GWT_JVM_ARGS,
@ -54,7 +55,7 @@ gwt_binary(
optimize = 0, optimize = 0,
module_deps = [':ui_module'], module_deps = [':ui_module'],
deps = DEPS, deps = DEPS,
local_workers = cpu_count(), local_workers = CPU_COUNT,
strict = True, strict = True,
experimental_args = GWT_COMPILER_ARGS, experimental_args = GWT_COMPILER_ARGS,
vm_args = GWT_JVM_ARGS, vm_args = GWT_JVM_ARGS,