git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: git@vger.kernel.org
Subject: Re: q: faster way to integrate/merge lots of topic branches?
Date: Wed, 23 Jul 2008 15:49:26 +0200	[thread overview]
Message-ID: <20080723134926.GA12888@elte.hu> (raw)
In-Reply-To: <20080723131736.GA9100@elte.hu>


* Ingo Molnar <mingo@elte.hu> wrote:

> So i guess it's better to just create a separate 
> .git/refs/merge-cache/ hierarchy with timestamps of last merged 
> branches and their head sha1 ... but maybe i'm banging on open doors?

here's the git-fastmerge script i've whipped up in 10 minutes. It does 
the trick nicely for me:

first run:

  real    0m53.228s
  user    0m41.134s
  sys     0m11.405s

second run:

  real    0m2.751s
  user    0m1.280s
  sys     0m1.491s

or a 20x speedup. Yummie! :-)

It properly notices when i commit to a topic branch, and it maintains a 
proper matrix of <A> <- <B> merge timestamps. It even embedds the sha1's 
in the timestamp path so it should be quite complete. It should work 
fine across resets, re-merges, etc. too i think. It should work well 
with renamed branches as well i think. (although i dont do that all that 
often)

In fact even if i delete the whole .git/mergecache/ hierarchy and run a 
'cold' merge, it's much faster:

  real    0m32.129s
  user    0m24.456s
  sys     0m7.603s

Because many of the branches have the same sha1 so it's already 
half-optimized even on the first run.

Much of the remaining 2.7 seconds overhead comes from the git-log runs 
to retrieve the sha1s, so i guess it could all be made even faster.

Now this scheme assumes that there's a sane underlying filesystem that 
can take these long pathnames and which has good timestamps (which i 
have, so it's not a worry for me).

Hm?

	Ingo

-----------------{ git-fastmerge }--------------------->
#!/bin/bash

usage () {
  echo 'usage: git-fastmerge <refspec>..'
  exit -1
}

[ $# = 0 ] && usage

BRANCH=$1

MERGECACHE=.git/mergecache

[ ! -d $MERGECACHE ] && { mkdir $MERGECACHE || usage; }

HEAD_SHA1=$(git-log -1 --pretty=format:"%H")
BRANCH_SHA1=$(git-log -1 --pretty=format:"%H" $BRANCH)

CACHE=$MERGECACHE/$HEAD_SHA1/$BRANCH_SHA1

[ -f "$CACHE" -a "$CACHE" -nt .git/refs/heads/$BRANCH_SHA1 ] && {
  echo "merge-cache hit on HEAD <= $1"
  exit 0
}

git-merge $1 && {
  mkdir -p $(dirname $CACHE)
  touch $CACHE
}

  reply	other threads:[~2008-07-23 13:50 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-23 13:05 q: faster way to integrate/merge lots of topic branches? Ingo Molnar
2008-07-23 13:17 ` Ingo Molnar
2008-07-23 13:49   ` Ingo Molnar [this message]
2008-07-23 14:47     ` Jay Soffian
2008-07-23 14:56       ` Ingo Molnar
2008-07-23 15:06         ` Ingo Molnar
2008-07-23 13:40 ` Andreas Ericsson
2008-07-23 14:02   ` Ingo Molnar
2008-07-23 14:57   ` Miklos Vajna
2008-07-23 13:41 ` Sergey Vlasov
2008-07-23 14:09   ` Ingo Molnar
2008-07-23 14:14     ` Ingo Molnar
2008-07-23 13:56 ` SZEDER Gábor
2008-07-23 14:04   ` Ingo Molnar
2008-07-23 17:59     ` Junio C Hamano
2008-07-23 22:09       ` [PATCH 1/2] builtin-branch.c: remove unused code in append_ref() callback function Junio C Hamano
2008-07-23 22:15       ` [PATCH] builtin-branch.c: optimize --merged and --no-merged Junio C Hamano
2008-07-24  7:16         ` Lars Hjemli
2008-07-24  8:29         ` Nanako Shiraishi
2008-07-24 10:03           ` Lars Hjemli
2008-07-24 15:29       ` q: faster way to integrate/merge lots of topic branches? Ingo Molnar
2008-07-23 18:04     ` Linus Torvalds
2008-07-23 18:12       ` Linus Torvalds
2008-07-23 20:01     ` Junio C Hamano
2008-07-24 15:27       ` Ingo Molnar
2008-07-25  8:46         ` Junio C Hamano
2008-07-23 14:06 ` Björn Steinbrink
2008-07-23 14:06 ` Santi Béjar
2008-07-23 17:59 ` Linus Torvalds
2008-07-23 19:09   ` Pierre Habouzit
2008-07-23 20:27     ` Pierre Habouzit
2008-07-23 20:40       ` Pierre Habouzit

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=20080723134926.GA12888@elte.hu \
    --to=mingo@elte.hu \
    --cc=git@vger.kernel.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).