On Wed, 25 Sep 2024 10:28:02 GMT, Eirik Bjørsnøs <[email protected]> wrote:

> Please review this test-only PR which adds a micro benchmark exploring 
> performance differences between reading entry data sequentially from a 
> `ZipFile` and reading the same entries using `ZipInputStream` wrapping a 
> `BufferedInputStream`.
> 
> Spoiler alert: `ZipFile` streams are ~1.8 X slower on my machine compared to 
> `ZipInputStream`:
> 
> 
> Benchmark                               (buffered)  (method)  (size)  Mode  
> Cnt     Score     Error  Units
> ReadZipStreams.zipFile                        true  DEFLATED    1024  avgt   
> 15  7871.679 ? 278.719  us/op
> ReadZipStreams.zipFile                        true    STORED    1024  avgt   
> 15  4976.571 ?  87.311  us/op
> ReadZipStreams.zipInputStream                 true  DEFLATED    1024  avgt   
> 15  4345.494 ?  40.628  us/op
> ReadZipStreams.zipInputStream                 true    STORED    1024  avgt   
> 15  2652.063 ?  13.617  us/op
> 
> 
>  When not using `BufferedInputStream`, most of the difference disappears, so 
> this is probably related to `ZipFileInputStream`'s lack of buffering:
> 
> 
> ReadZipStreams.zipFile                       false  DEFLATED    1024  avgt   
> 15  7980.705 ? 490.846  us/op
> ReadZipStreams.zipFile                       false    STORED    1024  avgt   
> 15  4994.301 ?  52.762  us/op
> ReadZipStreams.zipInputStream                false  DEFLATED    1024  avgt   
> 15  8367.171 ?  81.631  us/op
> ReadZipStreams.zipInputStream                false    STORED    1024  avgt   
> 15  4811.824 ?  47.859  us/op

This pull request has been closed without being integrated.

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

PR: https://git.openjdk.org/jdk/pull/21178

Reply via email to