Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why Gerrit build with Bazel built with JDK11 and ran with VanillaJavaBuilder is much faster than vanilla Bazel version? #7120

Closed
davido opened this issue Jan 14, 2019 · 1 comment
Labels
team-Rules-Java Issues for Java rules untriaged

Comments

@davido
Copy link
Contributor

davido commented Jan 14, 2019

I commented this experiment on this PR, but then decided to report it here.

Bazel@HEAD (94669e8) can be built with Java 11, so that something like this works:

  $ b10 build --define=ABSOLUTE_JAVABASE=/home/davido/pgm/jdk-11 \
  --host_javabase=@bazel_tools//tools/jdk:absolute_javabase \
  --host_java_toolchain=@bazel_tools//tools/jdk:toolchain_vanilla \
  --java_toolchain=@bazel_tools//tools/jdk:toolchain_vanilla \
  src:bazel-dev

Then to make use of it, I added this line to ~/.bazelrc:

$ tail -1 ~/.bazelrc
startup --server_javabase=/home/davido/pgm/jdk-11

And then I tested to build gerrit with Bazel-built-with-JDK11 and compared it building Gerrit with vanilla bazel 0.22rc2. The results are below:

  $ time b10 build --define=ABSOLUTE_JAVABASE=/home/davido/pgm/jdk-11 \
  --host_javabase=@bazel_tools//tools/jdk:absolute_javabase \
  --host_java_toolchain=@bazel_tools//tools/jdk:toolchain_vanilla \
  --java_toolchain=@bazel_tools//tools/jdk:toolchain_vanilla :release
[...]
  INFO: From Compiling 641 JavaScript files to polygerrit-ui/app/polygerrit_ui_closure_bin.js:
WARNING - Failed to resolve sourcemap at bazel-out/k8-fastbuild/bin/polygerrit-ui/app/web-animations-next-lite.min.js.map: bazel-out/k8-fastbuild/bin/polygerrit-ui/app/web-animations-next-lite.min.js.map
  Codes: SOURCEMAP_RESOLVE_FAILED

0 error(s), 1 warning(s)

Target //:release up-to-date:
  bazel-bin/release.war
INFO: Leaving sandboxfs mounted because of --sandbox_debug
INFO: Elapsed time: 238.288s, Critical Path: 121.96s
INFO: 1435 processes: 612 linux-sandbox, 7 local, 816 worker.
INFO: Build completed successfully, 2210 total actions

real	3m58.359s
user	0m0.061s
sys	0m0.068s

then I clean everything, including caches and re-run the build with vanilla Bazel 0.22-rc2:

  $ bazel version
Build label: 0.22.0rc2

  $ time bazel build :release
[...]

INFO: From Compiling 641 JavaScript files to polygerrit-ui/app/polygerrit_ui_closure_bin.js:
WARNING - Failed to resolve sourcemap at bazel-out/k8-fastbuild/bin/polygerrit-ui/app/web-animations-next-lite.min.js.map: bazel-out/k8-fastbuild/bin/polygerrit-ui/app/web-animations-next-lite.min.js.map
  Codes: SOURCEMAP_RESOLVE_FAILED

0 error(s), 1 warning(s)

Target //:release up-to-date:
  bazel-bin/release.war
INFO: Elapsed time: 288.698s, Critical Path: 101.78s
INFO: 1435 processes: 612 linux-sandbox, 7 local, 816 worker.
INFO: Build completed successfully, 2210 total actions

real	4m48.769s
user	0m0.056s
sys	0m0.075s

Do we have an explanation, why it takes 3m58.359s to build gerrit (with cold caches) with Bazel@JDK11 and VanillaJavaBuilder and 4m48.769s to build gerrit (with cold caches) with vanilla Bazel?

Is it only because of Error Prone integration and other neat features that vanilla Bazel offers and VanillaJavaBuilder lacking?

@jin jin added team-Rules-Java Issues for Java rules untriaged labels Jan 14, 2019
@davido
Copy link
Contributor Author

davido commented Jan 16, 2019

@davido davido closed this as completed Jan 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team-Rules-Java Issues for Java rules untriaged
Projects
None yet
Development

No branches or pull requests

2 participants