From: David Turner Date: Wed, 01 Jun 2016 19:50:29 GMT Subject: Re: [PATCH 0/2] strbuf: improve API Message-ID: <1464810629.3988.11.camel@twopensource.com> In-Reply-To: <20160601074218.GB14096@sigill.intra.peff.net> On Wed, 2016-06-01 at 03:42 -0400, Jeff King wrote: > 2. Do caching tricks for strbufs used in tight loops. For example, > have strbuf_release() throw its buffer into a last-used cache, > and > let the next strbuf_grow() use that cache entry. This cuts > malloc() > out of the loop. > > You'd probably want to protect the cache with a mutex, though. ... or make the last-used cache be thread-local.