rmahindra123 commented on a change in pull request #3128: URL: https://github.com/apache/hudi/pull/3128#discussion_r667254655
########## File path: hudi-common/src/main/java/org/apache/hudi/common/util/collection/DiskBasedMap.java ########## @@ -395,4 +417,48 @@ public int compareTo(ValueMetadata o) { return Long.compare(this.offsetOfValue, o.offsetOfValue); } } + + private static class DiskCompressionInstance implements Serializable { + public static final int DISK_COMPRESSION_INITIAL_BUFFER_SIZE = 1048576; + + // Caching ByteArrayOutputStreams to avoid recreating it for every operation + private final ByteArrayOutputStream compressBaos; + private final ByteArrayOutputStream decompressBaos; + private final byte[] decompressBuffer; + + DiskCompressionInstance() { + compressBaos = new ByteArrayOutputStream(DISK_COMPRESSION_INITIAL_BUFFER_SIZE); + decompressBaos = new ByteArrayOutputStream(DISK_COMPRESSION_INITIAL_BUFFER_SIZE); + decompressBuffer = new byte[8192]; + } + + public byte[] compressBytes(final byte [] value) throws IOException { Review comment: Yeah this is optimized for running as a single thread. -- 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: commits-unsubscr...@hudi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org