JDK-8150678 : JarFile stream() and entries() methods need performance enhancement
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util.jar
  • Affected Version: 9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2016-02-25
  • Updated: 2016-07-21
  • Resolved: 2016-07-21
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9Fixed
Related Reports
Relates :  
Relates :  
Description
The stream() and entries() methods share the JarEntryIterator which was made multi-release jar aware.  That change caused the methods to slow down when processing a jar file that is not multi-release.   It has been suggested that we should have two JarEntryIterator implementations, one for multi-release jars and one for regular jars.  This issue tracks the performance investigation and any updates that result from it.
Comments
The fix for JDK-8157524 changed the code for JarFile::entries and JarFile::stream back to JDK 8 code. Unfortunately we can't compare before and after tests because other changes to ZipFile in JDK 9 made significant performance improvements not related to these methods. For the record, here are the jmh micro benchmark numbers: JDK 8 ��� Benchmark Mode Cnt Score Error Units IteratorsTest.testBasicJarEnumeration avgt 50 9949.990 �� 251.323 us/op IteratorsTest.testBasicJarStream avgt 50 10080.520 �� 240.837 us/op JDK 9 ��� Benchmark Mode Cnt Score Error Units IteratorsTest.testBasicJarEnumeration avgt 50 1836.084 �� 100.647 us/op IteratorsTest.testBasicJarStream avgt 50 1912.664 �� 69.181 us/op So, the tests reveal a 5x speed up. Running the same benchmark with JDK 9 before the changes went in shows insignificant results. Benchmark Mode Cnt Score Error Units IteratorsTest.testBasicJarEnumeration avgt 50 1928.434 �� 86.779 us/op IteratorsTest.testBasicJarStream avgt 50 2298.722 �� 239.550 us/op
21-07-2016