> 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

Eirik Bjørsnøs has updated the pull request with a new target base due to a 
merge or a rebase. The incremental webrev excludes the unrelated changes 
brought in by the merge/rebase. The pull request contains three additional 
commits since the last revision:

 - Reduce benchmark allocation during reads by not using 
InputStream::transferTo. Usee data with a more representative compression rate.
 - Merge branch 'master' into zipstream-read-benchmark
 - Add micro benchmark comparing input stream performance of ZipFile vs 
ZipInputStream

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/21178/files
  - new: https://git.openjdk.org/jdk/pull/21178/files/fc0f8c7b..0f1e873b

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=21178&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=21178&range=00-01

  Stats: 173659 lines in 1069 files changed: 163363 ins; 5158 del; 5138 mod
  Patch: https://git.openjdk.org/jdk/pull/21178.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/21178/head:pull/21178

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

Reply via email to