Hi Volker,

On 2020-04-15 19:48, Volker Simonis wrote:
While doing this change, I've also realized that all the streams in
java.util.zip (i.e. DeflaterInputStream, GZIPInputStream,
GZIPOutputStream, InflaterInputStream, DeflaterOutputStream) use an
internal byte buffer of 512 bytes by default. Looking at the benchmark
attached to JDK-8242864, I think that increasing this default to a
bigger size (e.g. 4096 bytes) will considerably speed up (up to 50%)
read and write operations on these streams when they are created with
the default buffer size. I think the value "512" is a legacy of old
times when memory was more precious:)  so  I've opened "JDK-8242864:
Increase the default, internal buffer size of the Streams in
java.util.zip" to track that as as separate issue. Do you think it
makes sense to increase that default value?

Seems reasonable. 8192 seems to be the buffer size we've been converging
on elsewhere (see InputStream, BufferedInputStream, Files, ..). I also
found an instance of 8096, which is either a typo or a clever
optimization to keep the array + array object header fit snugly within
8Kb. You chose. :-)


Thank you and best regards,
Volker

PS: do you think it makes sense to contribute the benchmark attached
to JDK-8242864 to the code-tools/mh-jdk-microbenchmarks [1] project?

[1]http://openjdk.java.net/projects/code-tools/jmh-jdk-microbenchmarks/

I'd definitely welcome the micro as part of the patch under
test/micro/org/openjdk/bench/java/util/zip - additionally contributing
to jmh-jdk-microbenchmarks could enable you to test the micro on 8 or
11.

/Claes

Reply via email to