From: Jeff King Date: Wed, 09 May 2012 17:26:47 GMT Subject: Re: [PATCH] sha1_name: support sha1^{note} to return note sha-1 Message-ID: <20120509172647.GA30487@sigill.intra.peff.net> In-Reply-To: On Wed, May 09, 2012 at 04:09:35PM +0200, Johan Herland wrote: > > No idea. I have never worked/used notes until yesterday (and these > > patches were the result). I will look into it. > > IIRC, the initialization loads the top-level notes tree object into > memory. Subtrees (if any) are loaded on demand. FTR, if you have less > then ~256 notes in the notes tree, there will be no subtrees. As the > number of notes grows, the number of subtree levels grow roughly > logarithmically with the total number of notes (see determine_fanout() > for more details). Ah, right. I was thinking back to my original crappy implementation that didn't do fanout. So I don't think an init is that bad. It does look up the ref each time, but it will only load the top-level tree object (which you would need to do a lookup anyway). So it is probably OK to just do an init/lookup/free each time if it makes the code simpler (and I think it does). We probably won't be looking up sha1^{note} in a tight loop, anyway, since sha1 expressions like that generally come from the command line. -Peff