netty5/buffer/src
Nick Hill c6bdc2b7dc Reduce ByteBuffer duplication when resizing pooled direct ByteBufs (#9765)
Motivation:

Currently when use of Unsafe is disabled and an internal reallocation is
performed for a direct PooledByteBuf, a one-off temporary duplicate is
made of the source and destination backing nio buffers so that the
copy can be done in a threadsafe manner.

The need for this can be reduced by sharing the temporary duplicate
buffer that is already stored in the corresponding destination
PooledByteBuf instance.

Modifications:

Have PoolArena#memoryCopy(...) take the destination PooledByteBuf
instead of the underlying mem reference and offset, and use
internalNioBuffer() to obtain/initialize a reusable duplicate of the
backing nio buffer.

Result:

Fewer temporary allocations when resizing direct pooled ByteBufs in the
non-Unsafe case
2019-11-16 11:27:03 -08:00
..
main Reduce ByteBuffer duplication when resizing pooled direct ByteBufs (#9765) 2019-11-16 11:27:03 -08:00
test/java/io/netty/buffer Introduce ByteBuf#isContiguous() method (#9735) 2019-11-06 12:07:00 +01:00