Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

operations on ByteBuffer/IntBuffer #46

Open
phraktle opened this issue Nov 30, 2020 · 3 comments
Open

operations on ByteBuffer/IntBuffer #46

phraktle opened this issue Nov 30, 2020 · 3 comments

Comments

@phraktle
Copy link

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

@lemire
Copy link
Member

lemire commented Nov 30, 2020

 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/

@lemire
Copy link
Member

lemire commented Dec 1, 2020

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.

@huang-jesse
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants