mirror of
https://github.com/usatiuk/dhfs.git
synced 2025-10-28 20:47:49 +01:00
Objects: use bytebuffer to read
a little less GC pressure
This commit is contained in:
@@ -360,13 +360,12 @@ public class LmdbObjectPersistentStore implements ObjectPersistentStore {
|
||||
throw new NoSuchElementException("No more elements");
|
||||
}
|
||||
// TODO: Right now with java serialization it doesn't matter, it's all copied to arrays anyway
|
||||
// var val = _cursor.val();
|
||||
// var bbDirect = UninitializedByteBuffer.allocateUninitialized(val.remaining());
|
||||
// bbDirect.put(val);
|
||||
// bbDirect.flip();
|
||||
// var bs = UnsafeByteOperations.unsafeWrap(bbDirect);
|
||||
// var ret = Pair.of(JObjectKey.fromByteBuffer(_cursor.key()), bs);
|
||||
var ret = Pair.of(JObjectKey.fromByteBuffer(_cursor.key()), ByteString.copyFrom(_cursor.val()));
|
||||
var val = _cursor.val();
|
||||
var bbDirect = UninitializedByteBuffer.allocateUninitialized(val.remaining());
|
||||
bbDirect.put(val);
|
||||
bbDirect.flip();
|
||||
var bs = UnsafeByteOperations.unsafeWrap(bbDirect);
|
||||
var ret = Pair.of(JObjectKey.fromByteBuffer(_cursor.key()), bs);
|
||||
if (_goingForward)
|
||||
_hasNext = _cursor.next();
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user