From c20091450f48b34c909716452767312cfb8f2fc4 Mon Sep 17 00:00:00 2001 From: Philipp Wollermann Date: Tue, 21 Jun 2016 14:18:40 +0000 Subject: When running Java-based tools, use -XX:+TieredCompilation -XX:TieredStopAtLevel=1 instead of -client, as the latter is ignored on 64-bit JVMs since at least JDK 6. The new flags have been shown to cut down CPU time by 50% due to reduced time spent in JIT and improving overall run time for short running actions, some times also cutting them in half. Here's a benchmark of Bazel building itself, giving a nice 2-4x speedup: ./output/bazel clean && ./output/bazel build //src:bazel Bazel before this change: INFO: Elapsed time: 197.783s, Critical Path: 194.10s INFO: Elapsed time: 198.928s, Critical Path: 195.65s INFO: Elapsed time: 194.913s, Critical Path: 191.56s Bazel before this change with --strategy=Javac=worker: INFO: Elapsed time: 130.436s, Critical Path: 124.27s INFO: Elapsed time: 116.114s, Critical Path: 112.30s INFO: Elapsed time: 116.852s, Critical Path: 84.45s Bazel with this change: INFO: Elapsed time: 121.625s, Critical Path: 119.08s INFO: Elapsed time: 119.401s, Critical Path: 115.80s INFO: Elapsed time: 121.198s, Critical Path: 119.03s Bazel with this change and --strategy=Javac=worker: INFO: Elapsed time: 54.456s, Critical Path: 51.28s INFO: Elapsed time: 53.272s, Critical Path: 51.09s INFO: Elapsed time: 52.966s, Critical Path: 49.86s Bazel with this change and --strategy=Javac=worker and stripping -XX:TieredStopAtLevel=1 from JVM flags when using workers: INFO: Elapsed time: 61.599s, Critical Path: 58.93s INFO: Elapsed time: 48.695s, Critical Path: 45.02s INFO: Elapsed time: 46.874s, Critical Path: 43.91s INFO: Elapsed time: 46.174s, Critical Path: 43.32s (The latter is a possible optimization for workers and it's also nice to know that the limited tiered compilation does not hurt their performance.) -- MOS_MIGRATED_REVID=125448089 --- src/main/cpp/blaze.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/main/cpp') diff --git a/src/main/cpp/blaze.cc b/src/main/cpp/blaze.cc index c706c37ae0..b726ecf8a4 100644 --- a/src/main/cpp/blaze.cc +++ b/src/main/cpp/blaze.cc @@ -413,7 +413,8 @@ static vector GetArgumentArray() { blaze_util::Dirname(blaze_util::Dirname(globals->jvm_path)), &result); if (globals->options.batch) { - result.push_back("-client"); + result.push_back("-XX:+TieredCompilation"); + result.push_back("-XX:TieredStopAtLevel=1"); result.push_back("-Xms256m"); result.push_back("-XX:NewRatio=4"); } else { -- cgit v1.2.3