More customizable allocators
This commit is contained in:
parent
5b89be8ee0
commit
63beb1931e
@ -105,6 +105,7 @@ public class LLLocalDictionary implements LLDictionary {
|
|||||||
* Default: true
|
* Default: true
|
||||||
*/
|
*/
|
||||||
private static final boolean USE_DIRECT_BUFFER_BOUNDS = true;
|
private static final boolean USE_DIRECT_BUFFER_BOUNDS = true;
|
||||||
|
private static final int INITIAL_DIRECT_READ_BYTE_BUF_SIZE_BYTES = 4096;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
boolean assertionsEnabled = false;
|
boolean assertionsEnabled = false;
|
||||||
@ -235,7 +236,7 @@ public class LLLocalDictionary implements LLDictionary {
|
|||||||
ByteBuffer keyNioBuffer = LLUtils.toDirect(key);
|
ByteBuffer keyNioBuffer = LLUtils.toDirect(key);
|
||||||
assert keyNioBuffer.isDirect();
|
assert keyNioBuffer.isDirect();
|
||||||
// Create a direct result buffer because RocksDB works only with direct buffers
|
// Create a direct result buffer because RocksDB works only with direct buffers
|
||||||
ByteBuf resultBuf = alloc.directBuffer();
|
ByteBuf resultBuf = alloc.directBuffer(LLLocalDictionary.INITIAL_DIRECT_READ_BYTE_BUF_SIZE_BYTES);
|
||||||
try {
|
try {
|
||||||
int valueSize;
|
int valueSize;
|
||||||
int assertionReadData = -1;
|
int assertionReadData = -1;
|
||||||
|
@ -110,7 +110,7 @@ public interface SerializerFixedBinaryLength<A, B> extends Serializer<A, B> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull ByteBuf serialize(@NotNull Integer deserialized) {
|
public @NotNull ByteBuf serialize(@NotNull Integer deserialized) {
|
||||||
ByteBuf buf = allocator.directBuffer(Integer.BYTES);
|
ByteBuf buf = allocator.buffer(Integer.BYTES);
|
||||||
return buf.writeInt(deserialized);
|
return buf.writeInt(deserialized);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,7 +139,7 @@ public interface SerializerFixedBinaryLength<A, B> extends Serializer<A, B> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull ByteBuf serialize(@NotNull Long deserialized) {
|
public @NotNull ByteBuf serialize(@NotNull Long deserialized) {
|
||||||
ByteBuf buf = allocator.directBuffer(Long.BYTES);
|
ByteBuf buf = allocator.buffer(Long.BYTES);
|
||||||
return buf.writeLong(deserialized);
|
return buf.writeLong(deserialized);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user