[squid-dev] [PATCH] Faster SBuf::append

Alex Rousskov rousskov at measurement-factory.com
Thu Oct 6 17:20:28 UTC 2016


On 10/06/2016 10:57 AM, Amos Jeffries wrote:

> Please add a check to the unit test testSBuf::testAppendSBuf()
> to guarantee that the (*this = S) assignment code path updates the store
> reference count rather than doing a bit-wise copy of the SBuf.

I support that addition but do not have the time to implement it right
now. It would also be nice to add a test case that the optimized
assignment path does _not_ happen for pre-allocated SBufs.


>> P.S. AFAICT, there is no guarantee that SBuf using GetStorePrototype()
>> isEmpty so checking both conditions seems necessary to me.

> That sounds like a bug to me. If the initial prototype is anything but
> empty then the resulting new/clear'ed SBuf might end up with some random
> data prefix. Followup patch?

Not a bug AFAICT: The initial prototype storage might get dirty, but the
freshly initialized SBuf will be _empty_, making any storage bytes
irrelevant.


Thank you,

Alex.



More information about the squid-dev mailing list