gianm commented on code in PR #1270:
URL: https://github.com/apache/parquet-mr/pull/1270#discussion_r1548550219
##########
parquet-hadoop/src/main/java/org/apache/parquet/hadoop/codec/NonBlockedCompressor.java:
##########
@@ -100,7 +102,14 @@ public synchronized void setInput(byte[] buffer, int off,
int len) {
!outputBuffer.hasRemaining(), "Output buffer should be empty. Caller
must call compress()");
if (inputBuffer.capacity() - inputBuffer.position() < len) {
- ByteBuffer tmp = ByteBuffer.allocateDirect(inputBuffer.position() + len);
+ final int newBufferSize;
+ if (inputBuffer.capacity() == 0) {
+ newBufferSize = Math.max(INITIAL_INPUT_BUFFER_SIZE, len);
+ } else {
+ newBufferSize = Math.max(inputBuffer.position() + len,
inputBuffer.capacity() * 2);
Review Comment:
I haven't measured it, but probably the time spent is a function of the
number of iterations and the total amount of memory allocated and deallocated.
Compared to what I was seeing without any minimum-increase factor at all, `*
1.2` and `* 2` are both really big improvements.
I just changed the patch to do `* 1.2`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]