DESCRIPTION

JVMCBC-281: Allocate full KV header chunk upfront on encoding.

Motivation
----------
Currently, only the fixed 24 bytes are allocated for the header and
then all the params as well as the optional extras and key are written
into the header section.

It is very likely that the buffer needs to expand at least two times
if either the extras and/or the key take up more space.

Modifications
-------------
Since at the point of allocation we know the key and extras length,
the buffer can be preallocated with the exact size, avoiding unnecessary
resizing and even allocating too much (since it uses power of two
internally).

Result
------
Less buffer resizing needed when encoding a KV operation.

Change-Id: I0d34e122270f110eeb5638e4429cc990246dd891


COMMENTS

author: Natasha Sullivan
date: 2016-01-25 12:50:08.961000000

Uploaded patch set 1.

-------------------------------------
author: Natasha Sullivan
date: 2016-01-25 12:50:23.496000000

Patch Set 1: Verified+1

-------------------------------------
author: Estrella Humphrey
date: 2016-01-25 12:52:41.962000000

Patch Set 1: Code-Review-1

(1 comment)

Line:33, src/main/java/com/couchbase/client/deps/io/netty/handler/codec/memcache/binary/AbstractBinaryMemcacheEncoder.java -> rename to MEMCACHE_HEADER_SIZE or similar for clarity

-------------------------------------
author: Gerrit Code Review
date: 2016-01-25 12:57:04.897000000

Change has been successfully cherry-picked as 66d29669f19acdb3b17dca235f0c6d51a357eea1

-------------------------------------
