-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Long runtime classpaths slow down unit test execution #19480
Comments
The classpath pre-processing in this `java_stub_template.txt` loop: https://github.com/bazelbuild/bazel/blob/fcfcb929366dd3faac9643302b19c88bcf871ec6/src/main/java/com/google/devtools/build/lib/bazel/rules/java/java_stub_template.txt#L309 is slow for long classpaths. For example for classpaths with ~250,000 and ~700,000 entries the loop takes 28 and 50 seconds, respectively, on an intel MacBook. This change reduce the times to 1 second or less. Fixes bazelbuild#19480 Closes bazelbuild#19481. PiperOrigin-RevId: 564491123 Change-Id: Id4be898c3f800d5390dd8bf997535a5e71a76ba3
This is part of the logic that generates a separate jar file as a way to configure classpath that are too long to pass on the command line. @rsalvador I'm curious which JDK you're using, is it newer than JDK 8? The long term plan here is to replace this logic in the stub template with an (I'm also not sure why the stub template generates this every time it's executed, instead of having Bazel create a separate action that generates the separate jar file once; that came up in #19036.) |
@cushon using JDK 11: OpenJDK 64-Bit Server VM (build 11.0.19+7-LTS, mixed mode) by Azul Systems, Inc. |
…19491) The classpath pre-processing in this `java_stub_template.txt` loop: https://github.com/bazelbuild/bazel/blob/fcfcb929366dd3faac9643302b19c88bcf871ec6/src/main/java/com/google/devtools/build/lib/bazel/rules/java/java_stub_template.txt#L309 is slow for long classpaths. For example for classpaths with ~250,000 and ~700,000 entries the loop takes 28 and 50 seconds, respectively, on an intel MacBook. This change reduce the times to 1 second or less. Fixes #19480 Closes #19481. Commit 4e8f0bd PiperOrigin-RevId: 564491123 Change-Id: Id4be898c3f800d5390dd8bf997535a5e71a76ba3 Co-authored-by: Roman Salvador <[email protected]>
…19491) The classpath pre-processing in this `java_stub_template.txt` loop: https://github.com/bazelbuild/bazel/blob/fcfcb929366dd3faac9643302b19c88bcf871ec6/src/main/java/com/google/devtools/build/lib/bazel/rules/java/java_stub_template.txt#L309 is slow for long classpaths. For example for classpaths with ~250,000 and ~700,000 entries the loop takes 28 and 50 seconds, respectively, on an intel MacBook. This change reduce the times to 1 second or less. Fixes #19480 Closes #19481. Commit 4e8f0bd PiperOrigin-RevId: 564491123 Change-Id: Id4be898c3f800d5390dd8bf997535a5e71a76ba3 Co-authored-by: Roman Salvador <[email protected]>
A fix for this issue has been included in Bazel 6.4.0 RC1. Please test out the release candidate and report any issues as soon as possible. Thanks! |
@iancha1992 verified that the generated test script executables include the fix and that the test execution is faster than with 6.3.2 for a sample test (35 seconds with 6.3.2 vs 12 seconds with 6.4.0rc1) |
Description of the bug:
The classpath pre-processing loop in
java_stub_template.txt
is inefficient for very long classpaths and slows down unit test execution. The slowdown is in this loop in java_stub_template.txt:bazel/src/main/java/com/google/devtools/build/lib/bazel/rules/java/java_stub_template.txt
Line 309 in fcfcb92
Which category does this issue belong to?
Performance
What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Run a unit test with a very long runtime classpath.
Which operating system are you running Bazel on?
OSX
What is the output of
bazel info release
?release 6.1.0
If
bazel info release
returnsdevelopment version
or(@non-git)
, tell us how you built Bazel.No response
What's the output of
git remote get-url origin; git rev-parse master; git rev-parse HEAD
?No response
Is this a regression? If yes, please try to identify the Bazel commit where the bug was introduced.
Performance regression seems to have been introduced in d0ee889
Have you found anything relevant by searching the web?
No
Any other information, logs, or outputs that you want to share?
No response
The text was updated successfully, but these errors were encountered: