Repository navigation
Improve compressed stream handling - #3142
Conversation
|
Local testing with a large gzipped file shows a performance improvement of around 25% |
Seems to apply only for one specific elevation provider, but such high improvements are always nice. |
SRTM uncompression should also be around 10% faster now. |
| } | ||
| os.flush(); | ||
| GZIPInputStream gzis = new GZIPInputStream(is, 8 * 1024); | ||
| BufferedInputStream buff = new BufferedInputStream(gzis, 16 * 1024); |
There was a problem hiding this comment.
why is that double the size of the gzip input stream? could it be the same?
There was a problem hiding this comment.
I played a bit with the buffer sizes and this combination yielded the best results. It's also what Kafka is using: https://github.com/apache/kafka/pull/4537/files
There was a problem hiding this comment.
Thanks, interesting. But the question "How was the default buffer size chosen?" was left unanswered there too.
Anyway...not that important. Let's just copy that, especially when you say you got the best results :)
|
Thank you! |
The default buffer size for GZIPInputStream and InflaterInputStream is only 512 bytes, resulting in many tiny OS read calls.
I also replaced all custom InputStream to OutputStream piping with InputStream.transferTo(OutputStream) calls.