ajantha-bhat commented on a change in pull request #3638: [CARBONDATA-3731]
Avoid data copy in Writer
URL: https://github.com/apache/carbondata/pull/3638#discussion_r387449577
##########
File path:
core/src/main/java/org/apache/carbondata/core/datastore/compression/AbstractCompressor.java
##########
@@ -48,10 +49,11 @@
}
@Override
- public byte[] compressInt(int[] unCompInput) {
- ByteBuffer unCompBuffer = ByteBuffer.allocate(unCompInput.length *
ByteUtil.SIZEOF_INT);
+ public ByteBuffer compressInt(int[] unCompInput) {
+ ByteBuffer unCompBuffer = ByteBuffer.allocateDirect(unCompInput.length *
ByteUtil.SIZEOF_INT);
Review comment:
`DirecByteBuffer` are tricky, they reside outside JVM. we need to clean by
reflection. Hence it is not used in our code. (can use unsafe if we still need
to offheap memory)
DirecByteBuffers are useful only while interacting with native libraries.
So, I suggest we can use `ByteBuffer` instead of `DirectByteBuffer`
https://stackoverflow.com/questions/5670862/bytebuffer-allocate-vs-bytebuffer-allocatedirect
@ravipesala , @kumarvishal09 what's your opinion on this ?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services