From: "Shawn O. Pearce" <spearce@spearce.org>
To: Julian Phillips <julian@quantumfyre.co.uk>
Cc: git@vger.kernel.org
Subject: Re: Why are ref_lists sorted?
Date: Mon, 19 Mar 2007 01:33:31 -0400 [thread overview]
Message-ID: <20070319053331.GA22534@spearce.org> (raw)
In-Reply-To: <Pine.LNX.4.64.0703190520150.24247@beast.quantumfyre.co.uk>
Julian Phillips <julian@quantumfyre.co.uk> wrote:
> On Mon, 19 Mar 2007, Julian Phillips wrote:
>
> >A bit of investigation showed this to be due to the first attempt to read
> >a ref causing the packed refs to be loaded. In my test repo the
> >packed-refs file has over 9000 entries, but I still thought that it would
> >load faster than that. It turns out that the overhead is from sorting the
> >refs when building the ref_list. If I remove the code for sorting the
> >entries I lose that initial 1s delay, without appearing to break anything
> >in the fetch. However I assume that it's there for a reason ...
I have to say, I'm looking at the refs.c code and I'm not seeing
any reason why these need to be sorted. Granted, the current code
expects that as it walks both get_packed_refs() and get_loose_refs()
(as Junio pointed out), but change that code to toss both into a
single refs hash table, with the elements being the current contents
of struct ref_list.
We already have the ISPACKED flag in the flags field to tell us if
the ref is loose or not. When inserting a ref into the hash table
you keep the loose version (either if its in the table, or the one
being inserted).
--
Shawn.
next prev parent reply other threads:[~2007-03-19 5:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-19 3:38 Why are ref_lists sorted? Julian Phillips
2007-03-19 4:50 ` Junio C Hamano
2007-03-19 4:54 ` Shawn O. Pearce
2007-03-19 5:22 ` Julian Phillips
2007-03-19 5:33 ` Shawn O. Pearce [this message]
2007-03-19 5:42 ` Junio C Hamano
2007-03-19 17:03 ` Linus Torvalds
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=20070319053331.GA22534@spearce.org \
--to=spearce@spearce.org \
--cc=git@vger.kernel.org \
--cc=julian@quantumfyre.co.uk \
/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).