RFR: 8302623: jarsigner - use BufferedOutputStream to improve performance while creating the signed jar [v2]
Weijun Wang
weijun at openjdk.org
Fri Feb 17 15:06:58 UTC 2023
On Thu, 16 Feb 2023 14:55:10 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:
>> Can I please get a review for this change which improves the jarsigner tool's performance (especially) when dealing with large jar files? This addresses https://bugs.openjdk.org/browse/JDK-8302623.
>>
>> As noted in the JBS issue, wrapping the target `FileOutputStream` with the `BufferedOutputStream` reduces the amount of write calls that happen on the file and has shown to improve the amount of time it takes to sign the jar files.
>>
>> On a macOS M1, the numbers before and after this change are as follows (`time` command was used to get these numbers):
>>
>>
>> JDK 19, 3GB file: 144.52s user 19.79s system 98% cpu 2:46.80 total
>> JDK with this change, (same) 3GB file: 139.27s user 4.86s system 97% cpu 2:27.41 total
>>
>>
>> JDK 19, 6GB file: 289.38s user 38.87s system 99% cpu 5:28.90 total
>> JDK with this change, (same) 6GB file: 279.69s user 9.93s system 99% cpu 4:49.88 total
>>
>> No new tests have been added for this change. The current existing tests in `test/jdk/sun/security/tools/jarsigner` continue to pass locally. tier testing is currently in progress.
>
> Jaikiran Pai has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains two additional commits since the last revision:
>
> - merge latest from master branch
> - 8302623: jarsigner - use BufferedOutputStream to improve performance while creating the signed jar
src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Main.java line 1970:
> 1968: FileOutputStream fos = null;
> 1969: try {
> 1970: fos = new FileOutputStream(signedJarFile);
Can we make this change right at https://github.com/openjdk/jdk/blob/5dfc4ec7d94af9fe39fdee9d83b06101b827a3c6/src/jdk.jartool/share/classes/jdk/security/jarsigner/JarSigner.java#L691 or at least inside that class?
-------------
PR: https://git.openjdk.org/jdk/pull/12588
More information about the security-dev
mailing list