jdk: use parallel old gc and disable compact strings

When switching to JDK9 we regressed on java build performance by about ~30%.
We found that when using parallel gc instead of G1 and disabling compact
strings for JavaBuilder, the java build performance is "only" 10% slower.

We additionally found JDK9 to have a significantly higher startup time.
This impacts the performance of tools like javac and tubine and we
believe that this accounts for most of the remaining overhead that can't
be explained by disabling G1 and compact strings.

java8 -version: 80ms
java9 -version: 140ms
java10 -version: 110ms

Additionally, we found that the number of modules shipped with the JDK
have a direct effect on the startup time. When building Java 10 with only
the 9 modules required by Bazel we find that the startup time reduces to
80ms (from 110ms) which is on par with Java 8.

We thus expect the regression to be fixed by a future migration to Java 10,
which should be done in one of the next Bazel releases.

== Some benchmark results ==
https://github.com/google/protobuf
$ bazel build :protobuf_java
Bazel 0.15.2: 4.2s
Bazel 0.16.0-rc2: 5.2s
This Change: 4.2s

https://github.com/jin/android-projects/tree/master/java_only
$ bazel build :module0
Bazel 0.15.2: 8.2s
Bazel 0.16.0-rc2: 11.5s
This Change: 9.1s

RELNOTES: None
PiperOrigin-RevId: 205647957
2 files changed
tree: 9f5020781ac5a103a8f2a1c04f68a9b3302a90c4
  1. .bazelci/
  2. examples/
  3. scripts/
  4. site/
  5. src/
  6. third_party/
  7. tools/
  8. .gitattributes
  9. .gitignore
  10. AUTHORS
  11. BUILD
  12. CHANGELOG.md
  13. combine_distfiles.py
  14. combine_distfiles_to_tar.sh
  15. compile.sh
  16. CONTRIBUTING.md
  17. CONTRIBUTORS
  18. distdir.bzl
  19. ISSUE_TEMPLATE.md
  20. LICENSE
  21. README.md
  22. WORKSPACE
README.md

Bazel

{Fast, Correct} - Choose two

Build and test software of any size, quickly and reliably.

  • Speed up your builds and tests: Bazel only rebuilds what is necessary. With advanced local and distributed caching, optimized dependency analysis and parallel execution, you get fast and incremental builds.

  • One tool, multiple languages: Build and test Java, C++, Android, iOS, Go, and a wide variety of other language platforms. Bazel runs on Windows, macOS, and Linux.

  • Scalable: Bazel helps you scale your organization, codebase, and continuous integration solution. It handles codebases of any size, in multiple repositories or a huge monorepo.

  • Extensible to your needs: Easily add support for new languages and platforms with Bazel's familiar extension language. Share and re-use language rules written by the growing Bazel community.

Getting Started

Documentation

Contributing to Bazel

See CONTRIBUTING.md

Build status

Bazel is released in ‘Beta’. See the product roadmap to learn about the path toward a stable 1.0 release.