RFR: 8260617: Merge ZipFile encoding check with the initial hash calculation
Claes Redestad
redestad at openjdk.java.net
Fri Jan 29 09:56:57 UTC 2021
On Fri, 29 Jan 2021 00:54:46 GMT, Claes Redestad <redestad at openjdk.org> wrote:
> - Merge checkEncoding into the byte[]-based normalizedHash. The latter is only used from ZipFile.initCEN right after the checkEncoding today, so verifying this is equivalent is straightforward.
> - Factor out the logic to calculate hash, check encoding etc into the addEntry method to allow JITs to chew off larger chunks of the logic early on
>
> Roughly 1.2x speedup on the JarFileMeta microbenchmarks, which include the time required to open the jar file and thus exercising the optimized code.
>
> Testing: tier1-4
Baseline:
Benchmark (size) Mode Cnt Score Error Units
JarFileMeta.getManifestFromJarWithManifest 512 avgt 5 246.534 ± 32.934 us/op
JarFileMeta.getManifestFromJarWithManifest 1024 avgt 5 475.978 ± 70.689 us/op
JarFileMeta.getStreamFromJarWithManifest 512 avgt 5 243.401 ± 33.190 us/op
JarFileMeta.getStreamFromJarWithManifest 1024 avgt 5 465.899 ± 58.306 us/op
JarFileMeta.getStreamFromJarWithNoManifest 512 avgt 5 243.480 ± 44.631 us/op
JarFileMeta.getStreamFromJarWithNoManifest 1024 avgt 5 454.937 ± 55.268 us/op
JarFileMeta.getStreamFromJarWithSignatureFiles 512 avgt 5 267.522 ± 48.914 us/op
JarFileMeta.getStreamFromJarWithSignatureFiles 1024 avgt 5 509.779 ± 81.314 us/op
Patched:
JarFileMeta.getManifestFromJarWithManifest 512 avgt 5 186.973 ± 26.564 us/op
JarFileMeta.getManifestFromJarWithManifest 1024 avgt 5 360.141 ± 33.414 us/op
JarFileMeta.getStreamFromJarWithManifest 512 avgt 5 186.244 ± 30.014 us/op
JarFileMeta.getStreamFromJarWithManifest 1024 avgt 5 362.870 ± 61.271 us/op
JarFileMeta.getStreamFromJarWithNoManifest 512 avgt 5 182.841 ± 13.797 us/op
JarFileMeta.getStreamFromJarWithNoManifest 1024 avgt 5 354.254 ± 67.377 us/op
JarFileMeta.getStreamFromJarWithSignatureFiles 512 avgt 5 215.419 ± 20.463 us/op
JarFileMeta.getStreamFromJarWithSignatureFiles 1024 avgt 5 403.043 ± 78.926 us/op
-------------
PR: https://git.openjdk.java.net/jdk/pull/2306
More information about the core-libs-dev
mailing list