From: Junio C Hamano <gitster@pobox.com>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: git@vger.kernel.org, Johan Herland <johan@herland.net>
Subject: Re: [PATCH] Introduce light weight commit annotations
Date: Sun, 10 Jun 2007 16:29:38 -0700 [thread overview]
Message-ID: <7v4plf5qxp.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <Pine.LNX.4.64.0706102333050.4059@racer.site> (Johannes Schindelin's message of "Mon, 11 Jun 2007 00:00:09 +0100 (BST)")
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> I do not understand... the entries of a tree object are sorted
> alphabetically, right? Including the convention that if one is a prefix of
> another, it is "smaller".
>
> While I think that the length would not be any problem, the entries' names
> of refs/annotations/commit^{tree} are _all_ of length two, and point to
> other tree objects. _Those_ tree objects contain _only_ entries whose
> names contain exactly 38 characters.
That is ONLY true if you are introducing a specialized tree
object parser that knows it is dealing with the tree used in
your annotation scheme that has entries of uniform size. In
such a tree parser, you could bisect or Newton-Raphson a tree
object data to find an entry more efficiently than for normal
trees with enries of variable size.
But I do not think you are planning to do that (nor I would
recommend you to). With the normal tree parser, the lookup for
"refs/annotations/commit:??/?{38}" you have in your code would
open one tree (the commit's tree), find the one with leading 2
hexdigits you would want among up to 256 entries with linear
search (see tree-walk.c::find_tree_entry()), open that entry
which is another tree, and do the same linear search to find the
entry with the remaining 38 hexdigits. Finding annotation for
commit 0000abcd... is much less expensive than ffff4567...
>> It will hurt _if_ we introduce a new tree object format that would give
>> you a quick random-access at an entry, but it is premature to worry
>> about that now.
>
> I do not see that. Care to enlighten me?
At some point (probably git v3.0.0) we _might_ enhance/extend
the tree object format so that it has an auxiliary hash table to
help you look up an arbitrary entry in a huge tree object (huge
in the sense that readdir(3) returns many entries, not in the
sense that find(1) returns many results) more efficiently. Pack
v4 is rumored to have something like that for in-pack trees.
If that happens, "refs/annotations/commit:?{40}" format would
let you look up an annotation for a given commit much more
efficiently than "refs/annotations/commit:??/?{38}", because it
would have to open only one tree object, instead of two.
next prev parent reply other threads:[~2007-06-10 23:29 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-09 17:55 [PATCH] Introduce light weight commit annotations Johannes Schindelin
2007-06-10 13:14 ` Johan Herland
2007-06-10 18:56 ` Johannes Schindelin
2007-06-10 19:20 ` Johan Herland
2007-06-10 19:53 ` Johannes Schindelin
2007-06-10 22:11 ` Junio C Hamano
2007-06-10 23:00 ` Johannes Schindelin
2007-06-10 23:29 ` Junio C Hamano [this message]
2007-06-11 10:25 ` Johannes Schindelin
2007-06-12 17:28 ` Johannes Schindelin
2007-06-10 22:58 ` Alex Riesen
2007-06-10 23:20 ` Alex Riesen
2007-06-11 1:11 ` Junio C Hamano
2007-06-11 2:09 ` Nicolas Pitre
2007-06-11 7:24 ` Alex Riesen
2007-06-11 7:43 ` Junio C Hamano
2007-06-11 8:05 ` Alex Riesen
2007-06-11 10:22 ` Johannes Schindelin
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=7v4plf5qxp.fsf@assigned-by-dhcp.cox.net \
--to=gitster@pobox.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=johan@herland.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.