git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Set up for better tree diff optimizations

From
Junio C Hamano <junkio@cox.net>
Date
Mar 21, 2007, 19:05 UTC
Message-ID
<7vhcse1kpu.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<Pine.LNX.4.64.0703211110050.6730@woody.linux-foundation.org>
Linus Torvalds <torvalds@linux-foundation.org> writes:
Show 12 quoted lines
> On Wed, 21 Mar 2007, Junio C Hamano wrote:
> ...
>> Would something like this suit your taste?
>
> This looks fine, although the reason I didn't get it done myself is that I 
> have this nagging feeling that there must be some clever way to make it 
> even faster. I hated having to do the "strncmp()" early, when it's not 
> always needed. 
>
> But like your patch, I could never come up with a way to *both* do the 
> "don't strncmp() if you don't have to" *and* do the "nothing further will 
> be interesting any more" optimization..

I briefly tried match[0] < path[0] as a compromise, but it did not fly well with the eclipse example for obvious reasons ;-).

Show 10 quoted lines
>> The "rev-list org.eclipse.debug.ui/" test that took 16-17
>> seconds takes 9 seconds with this patch.  Running with a
>> diffrent pathspec "org.apache.ant/" obviously makes it go a lot
>> faster (15sec vs 7sec).
>
> Yeah, and conversely, a pathspec at the end of the list of paths will make 
> it less of an optimization. But in general it shouldn't ever be a loss 
> except for the rather rare case of asking for a path at the end of a tree, 
> and then the loss should be pretty small (ie it's the result of doing a 
> few strncmp's that we used to be able to skip).

We _could_ check never_interesting first and if it is already dropped then defer strncmp() and check the pathlen > matchlen comparison first.

Previous: Linus TorvaldsNext: Junio C Hamano
Message 6 of 8 in “Set up for better tree diff optimizations”
  1. Linus TorvaldsMar 18, 2007
  2. Junio C HamanoMar 21, 2007
  3. Linus TorvaldsMar 21, 2007
  4. Junio C HamanoMar 21, 2007
  5. Linus TorvaldsMar 21, 2007
  6. Junio C HamanoMar 21, 2007
  7. Junio C HamanoMar 21, 2007
  8. Junio C HamanoMar 22, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.