git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Shawn Pearce <spearce@spearce.org>
To: Junio C Hamano <junkio@cox.net>
Cc: Christian Couder <chriscool@tuxfamily.org>, git@vger.kernel.org
Subject: Re: [PATCH 1/2] Delete ref $frotz by moving ref file to "deleted-$frotz~ref".
Date: Tue, 17 Oct 2006 01:07:14 -0400	[thread overview]
Message-ID: <20061017050714.GA21210@spearce.org> (raw)
In-Reply-To: <7v4pu3tuye.fsf@assigned-by-dhcp.cox.net>

Junio C Hamano <junkio@cox.net> wrote:
> Christian Couder <chriscool@tuxfamily.org> writes:
> 
> > For example, when git becomes a major SCM, there may be people working on 
> > big projects that want to create a new branch for each new bug and then 
> > delete the branch when the code on the bug branch has been integrated into 
> > a new release and the bug is closed.
> 
> I would say that is a very valid way to work with git,
> regardless of the size of project.  Now, how often would you
> create such a per-bug branch and delete one, compared to the
> number of operations that would require ref lookups?  Your
> example actually supports what I've said -- optimizing for
> deletion at the cost of more expensive lookups is wrong.

I agree completely with Junio.  I make a lot of temporary "throw
away" branches in Git; often they live on disk for 5/10 minutes at
most before getting deleted again.  I also make a smaller number
(but still significant) of longer lived branches that hang around
for days or weeks before getting deleted.

In the former case (throw away) I wouldn't want those refs added
to the packed refs file.  They just don't live around long enough
to make it worth it.  And when I delete them I want them gone.
So moving them off to a 'deleted-refs' directory to indicate they
are gone is just delaying the removal.  Not something I want.

In the latter case (longer lived) I don't mind if I have to sit
though an extra 500 ms to rewrite the entire packed refs file
during a ref delete operation.  I lived with the branch for weeks;
I can probably spare a second to finally get rid of it once its
gone upstream.  Heck, the push to move that branch upstream might
actually take longer to unpack the loose objects contained on that
branch than the packed ref delete, even on 1000s of refs.
 
> If the goal is to optimize for deletion path, then that is
> true.  My point is that we do not want to optimize for deletion
> path at the expense of more costly lookup path.

Absolutely.  I figure I do ref lookups at least 3x the number of ref
deletes I perform.  And that's just thinking about the sequence of
commands I commonly perform against my "throw away" branches which
live for at most 10 minutes, let alone my longer lived branches
that hang around for weeks.

-- 
Shawn.

  reply	other threads:[~2006-10-17  5:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-14 13:39 [PATCH 1/2] Delete ref $frotz by moving ref file to "deleted-$frotz~ref" Christian Couder
2006-10-14 18:47 ` Junio C Hamano
2006-10-17  4:26   ` Christian Couder
2006-10-17  4:41     ` Junio C Hamano
2006-10-17  5:07       ` Shawn Pearce [this message]
2006-10-17  9:24     ` Jakub Narebski

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=20061017050714.GA21210@spearce.org \
    --to=spearce@spearce.org \
    --cc=chriscool@tuxfamily.org \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    /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).