RFR: 8376403: Avoid loading ArrayDeque in java.util.zip.ZipFile [v4]
Eirik Bjørsnøs
eirbjo at openjdk.org
Fri Feb 20 12:51:13 UTC 2026
On Fri, 20 Feb 2026 12:41:49 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:
> I remember there was some discussion around the Inflater cache usage and how it may impact the performance. In this PR we have changed the policy on which Inflater we hand out from the cache, I would like to make sure that it doesn't have any unforeseen impact.
Sure! My gut feeling is that a more recently used Inflater should if anything have better performance based on more recently used memory buffers. But who knows.
I know that Martin investigated the usefulness of this cache (a 'pool' really?) and found it questionable:
https://bugs.openjdk.org/browse/JDK-8156484
> src/java.base/share/classes/java/util/zip/ZipFile.java line 719:
>
>> 717: synchronized (inflaterCache) {
>> 718: if (!inflaterCache.isEmpty()) {
>> 719: return inflaterCache.removeLast();
>
> The use `removeLast()` I think is fine. Can you add a one liner comment here to say something like:
>
> // return back the most recently used Inflater from the cache of not-in-use Inflaters
Added comment as suggested.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/29430#issuecomment-3934165851
PR Review Comment: https://git.openjdk.org/jdk/pull/29430#discussion_r2833034302
More information about the core-libs-dev
mailing list