JavaFastPFOR
JavaFastPFOR copied to clipboard
operations on ByteBuffer/IntBuffer
Hi,
I'm interested in decoding integers from an off-heap direct buffer, but I currently see no way of doing this without copying them to the heap. Is there a suggested method of doing this? Is there a fundamental (eg. performance) reason why this is not implemented or is it just to avoid the complexity?
Thanks, Viktor
Is there a fundamental (eg. performance) reason why this is not implemented or is it just to avoid the complexity?
Does the following help?
Java Buffer types versus native arrays: which is faster? https://lemire.me/blog/2020/11/30/java-buffer-types-versus-native-arrays-which-is-faster/
If someone would like to propose pull requests leveraging Buffer types, I would be eager to review it. However, one has to be mindful of the performance considerations... and it is not trivial...
The complexity is not much of an issue. One could almost entirely automate the conversion process with a script.
However, it would be easy for a user to get bad performance, through no fault of their own, by misusing the Buffer types. So one would need to add good documentation/guidance.
Good insight. I recently implemented a TSDB using DirectByteBuffer to hold int data, because I didn't want a transfer station (and wanted to save memory), so I did not use native arrays
.
However, your opinion makes sense. native arrays
may provide better performance compared to ByteBuffer.