mapdb icon indicating copy to clipboard operation
mapdb copied to clipboard

Simplest way to get value as byte buffer with only 1 memory copy operation

Open pranasblk opened this issue 5 years ago • 0 comments

I've noticed even using regular value serializer SerializerArray would cause multiple copies of underlying raw bytes. Ideally I'd like to get only 1 copy for thread safety.

What's the simplest way to get byte[]/ByteBuffer for key with minimum number (1) memory copy operations from DirectStore?

I've done some code checks and looks like it's doable by creating custom deserializer. Is it safe to assume, what DataInput2.internalByteBuffer will have copy already ready if it's retrieved from DirectStore or there are more copies of memory one should be aware of?

Thanks!

pranasblk avatar Nov 22 '19 06:11 pranasblk