Github user vrozov commented on a diff in the pull request: https://github.com/apache/drill/pull/1060#discussion_r165552608 --- Diff: exec/memory/base/src/main/java/io/netty/buffer/DrillBuf.java --- @@ -703,7 +703,18 @@ protected void _setLong(int index, long value) { @Override public ByteBuf getBytes(int index, ByteBuf dst, int dstIndex, int length) { - udle.getBytes(index + offset, dst, dstIndex, length); + final int BULK_COPY_THR = 1024; --- End diff -- My testing shows that `PlatformDependent.copyMemory` outperforms multiple calls to `PlatformDependent.getByte()`/`PlatformDependent.putByte()` starting with 16 bytes. Copying 1024 bytes buffer using `getByte()`/`putByte()` is 10x slower compared to `copyMemory()`.
---