RFR: 8317678: Fix up hashCode() for ZipFile.Source.Key [v10]

Sean Coffey coffeys at openjdk.org
Mon Oct 23 13:08:33 UTC 2023


On Mon, 23 Oct 2023 13:04:20 GMT, Sean Coffey <coffeys at openjdk.org> wrote:

>> Fix up java.util.zip.ZipFile$Source hashCode() impl so that duplicate Source objects aren't created for the same zip file.
>
> Sean Coffey has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Incorporate test review comments from Jai

Thanks for the review Jai. I've edited the test to use` ZipFile z = new ZipFile(relativeFile)` in both places. 

Regards the JMH benchmark, note that there is a significant performance gain for some environments with this patch. 2X improvement for filesystems that support fileKey() and deal with opening of a zip file twice (or more) but with different variants of path name. The benchmark update was useful for highlighting this. The existing ` src = files.get(key);` ZipFile code call is key to this improvement. Now that hashcode() is corrected, a new <Key, Source> pairing is avoided for the same zip file.

p.s. I've run test-repeat on mach5 for this new test a few times already. It was test repeat 20 or 30 IIRC. I'll bump it to 50 for last test round before integrating.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/16115#issuecomment-1775148314


More information about the core-libs-dev mailing list