git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Gavrilov <angavrilov@gmail.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>
Subject: Re: [RFC PATCH] Fix quadratic performance in rewrite_one.
Date: Sun, 13 Jul 2008 04:37:58 +0400	[thread overview]
Message-ID: <200807130437.59141.angavrilov@gmail.com> (raw)
In-Reply-To: <alpine.LFD.1.10.0807121550320.2959@woody.linux-foundation.org>

On Sunday 13 July 2008 02:55:27 Linus Torvalds wrote:
> On Sat, 12 Jul 2008, Alexander N. Gavrilov wrote:
> > Parent commits are usually older than their children. Thus,
> > on each iteration of the loop in rewrite_one, add_parents_to_list
> > traverses all commits previously processed by the loop.
> > It performs very poorly in case of very long rewrite chains.
>
> Good call, but you don't seem to invalidate the cache when we remove
> things from the list.

The cache is local to rewrite_one, and is invalidated by exiting from that 
function. Other users of add_parents_to_list just pass NULL as cache_ptr, 
thus causing insert_by_date_cached to degenerate into a simple 
insert_by_date.

> The top of the limit_list() loop does that "get top entry from list, an
> free it", and I'm not seeing you invalidating the cache if that entry that
> just got free'd happened to be the cache entry?

This type of workflow can be expected to keep the list relatively short 
(roughly limited by the number of simultaneously existing branches); and if 
it is already long, new entries will probably be added near the beginning 
anyway, so there doesn't seem to be any need to use caching. 

rewrite_one() is special in that it can sometimes walk through thousands of 
commits at once and put them all into the list -- i.e. it is bound not by the 
width of the history, but by its length.

Alexander

      reply	other threads:[~2008-07-13  0:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-12 18:00 [RFC PATCH] Fix quadratic performance in rewrite_one Alexander N. Gavrilov
2008-07-12 22:55 ` Linus Torvalds
2008-07-13  0:37   ` Alexander Gavrilov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200807130437.59141.angavrilov@gmail.com \
    --to=angavrilov@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).