Most appends start with an empty buffer. Some append only once. There
is no reason to allocate new memory for that first append or force the
appender to write code to optimize that first append.
Why also check that SBuf has never been configured or altered then? To
preserve pre-allocated SBufs, such as those [ab]used as I/O buffers.
SBuf&
SBuf::append(const SBuf &S)
{
+ if (isEmpty() && store_ == GetStorePrototype())
+ return (*this = S); // optimization: avoid needless copying
+
const Locker blobKeeper(this, S.buf());
return lowAppend(S.buf(), S.length());
}