From: Jeff King Date: Fri, 20 Mar 2026 06:18:52 GMT Subject: Re: [RFC] cocci: .buf in a strbuf object can never be NULL Message-ID: <20260320061852.GA35538@coredump.intra.peff.net> In-Reply-To: <20260320055709.GA35291@coredump.intra.peff.net> On Fri, Mar 20, 2026 at 01:57:09AM -0400, Jeff King wrote: > I haven't measured to see what the exact cost is, but I know that > looping over a strbuf (with a reset in the loop, or the implied reset > from a getline call) is a common optimization trick that does have a > measurable improvement for some cases. Try something like this: # input file is all objects in linux.git cd linux.git git repack -ad git show-index <.git/objects/pack/pack-*.idx | cut -d' ' -f2 >input # now do something that primarily reads a bunch of lines git cat-file --buffer --batch-check='%(objectname)"