-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
8293499: Provide jmod --compress option #10213
8293499: Provide jmod --compress option #10213
Conversation
👋 Welcome back shade! A progress list of the required criteria for merging this PR into |
Webrevs
|
I don't have time to look at this closely today but I think an option to configure the compression level wouldn't look out of place on the jmod tool. Doing the equivalent with jlink would require more thought to see if it makes sense or is really needed. The jimage format is for execution, not a packaging format like jmod that is primarily consumed at link-time. I agree the jlink --compress option is a bit overloaded where --compress=0 and --compress=2 are more like jar --no-compress or its default to deflate. The jar tool doesn't have an option to set the compression level. |
It's reasonable for jmod tool to support For jlink, when resources are compressed in writing to jimage, there would be performance overhead in reading and decompressing the resources at runtime. I'd be interested in knowing the tradeoff between the smaller jimage vs the runtime overhead in decompressing the resources. I'd advice to separate the jmod compression level change from jlink compression level discussion. |
I went through the changes and I don't see anything obviously wrong. The command line option doesn't look out of place although as Mandy points us, the format is not documented so there is flexibility to change it in the future. If some future format doesn't support something like compression level then that option could just emit a warning and do nothing. |
/csr |
@AlanBateman has indicated that a compatibility and specification (CSR) request is needed for this pull request. @shipilev please create a CSR request for issue JDK-8293499 with the correct fix version. This pull request cannot be integrated until the CSR request is approved. |
I submitted the CSR request for this change: https://bugs.openjdk.org/browse/JDK-8293629 |
Could we word this so that the accepted values is compression-dependent? The value appears to be ignored for |
src/jdk.jlink/share/classes/jdk/tools/jmod/resources/jmod.properties
Outdated
Show resolved
Hide resolved
I gave this a try locally. It's my understanding that this new option is only relevant when creating the
Should we instead complain/fail when this option is used for anything other than |
Um, this is |
Good idea, see new commit. |
Doh! Yes, I mixed up the two and assumed you'd be considering this for |
src/jdk.jlink/share/classes/jdk/tools/jmod/resources/jmod.properties
Outdated
Show resolved
Hide resolved
Thank you for the changes Aleksey. They look fine to me (except for that one minor error message related issue which I added a comment for). I haven't given the latest changes a try, but the new test you added to verify that the command fails in other modes when |
Well, we can future-proof it by doing what e.g. ZFS does:
Meaning, we allow |
I like this scheme. It's a good thing there's prior art, too. |
Agreed. With this approach we can also revise |
I updated this PR and related CSR with this new option format. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also like the new --compress
option taking zip-0, zip-1,... zip-9
values.
src/jdk.jlink/share/classes/jdk/tools/jmod/JmodOutputStream.java
Outdated
Show resolved
Hide resolved
src/jdk.jlink/share/classes/jdk/tools/jmod/JmodOutputStream.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The latest state of this PR looks fine to me.
src/jdk.jlink/share/classes/jdk/tools/jmod/resources/jmod.properties
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. The jmod usage should specify the default.
Hello Aleksey, could you also please create a release note for this? You may already know how to do that, if not, the steps are noted here https://openjdk.org/guide/#release-notes |
Yes, but later, once CSR and this PR integrates in its final form. |
(posting a comment in the hopes that bots would check the CSR state) |
@shipilev This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 66 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
I did a minor cleanup, unquoted: |
Thank you! /integrate |
Going to push as commit 43f7f47.
Your commit was automatically rebased without conflicts. |
I have been looking into
make clean-images images
performance, and realized jmod keeps compressing files with default compression level. Tuning that toward lighter compression levels improves build performance considerably, without a heavy loss in *.jmod sizes.This PR allows JMOD to select the compression level. Follow-ups would use this in the build system, see #10214.
The interesting asymmetry against
jlink
is:jlink
provides--compress
option that only takes2
for "ZIP compression". (Separately, we could argue if it would be beneficial to extend--compress
tojlink
as well, so to select the compression level there too.)Progress
Issues
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/10213/head:pull/10213
$ git checkout pull/10213
Update a local copy of the PR:
$ git checkout pull/10213
$ git pull https://git.openjdk.org/jdk pull/10213/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 10213
View PR using the GUI difftool:
$ git pr show -t 10213
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/10213.diff