Has anyone considered whether copy-on-write semantics would be useful
for safeBuffers?  Under a profiler, it looks like my application spends
an astonishing amount of time in the memcpy() in safeBuffer::operator=
(const safeBuffer &).  If safeBuffer strings are typically written after
being copied, the buffer copy is unavoidable, but if they're generally
just read, it might be more efficient to keep a reference count and just
copy the pointer.  Making a new copy of the buffer would be deferred
until the string needed to be updated, if ever.

I'm not particularly familiar with the code base, so I'm not sure how
invasive this would be, and whether it is likely to yield any real
benefit.  Before I contemplate undertaking an analysis, I'm wondering
Berin or anyone else has any thoughts as to whether it's likely to be
worthwhile.

Reply via email to