Re: [PATCH 1/4] strbuf: add strbuf_add_uint()
- From
Jeff King <peff@peff.net>
- Date
- May 13, 2026, 16:49 UTC
- Message-ID
- <20260513164948.GE103037@coredump.intra.peff.net>
- In-Reply-To
- <20260513162232.GB103037@coredump.intra.peff.net>
On Wed, May 13, 2026 at 12:22:32PM -0400, Jeff King wrote:
> I guess it is not too surprising that they all come pretty close in > whole-process benchmarks. These are all micro-optimizations of a > relatively small portion of the total work the process is doing. Even > the strbuf_grow() checks are probably slower!
And btw, one final thing to look at if you are interested in micro-optimizing strbufs: using intrinsics for overflow detection.
Right now we use unsigned_add_overflows(), and then do the actual add. Using __builtin_add_overflow() might be faster.
-Peff