git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Johan Herland <johan@herland.net>
Cc: Nguyen Thai Ngoc Duy <pclouds@gmail.com>, git@vger.kernel.org
Subject: Re: [PATCH] sha1_name: support sha1^{note} to return note sha-1
Date: Wed, 9 May 2012 13:26:47 -0400	[thread overview]
Message-ID: <20120509172647.GA30487@sigill.intra.peff.net> (raw)
In-Reply-To: <CALKQrgdGCoKooM7KayNMQ_+Fg9=-1YnwNE_9NHzpX0jfoRjT_A@mail.gmail.com>

On Wed, May 09, 2012 at 04:09:35PM +0200, Johan Herland wrote:

> > No idea. I have never worked/used notes until yesterday (and these
> > patches were the result). I will look into it.
> 
> IIRC, the initialization loads the top-level notes tree object into
> memory. Subtrees (if any) are loaded on demand. FTR, if you have less
> then ~256 notes in the notes tree, there will be no subtrees. As the
> number of notes grows, the number of subtree levels grow roughly
> logarithmically with the total number of notes (see determine_fanout()
> for more details).

Ah, right. I was thinking back to my original crappy implementation that
didn't do fanout. So I don't think an init is that bad. It does look up
the ref each time, but it will only load the top-level tree object
(which you would need to do a lookup anyway).

So it is probably OK to just do an init/lookup/free each time if it
makes the code simpler (and I think it does). We probably won't be
looking up sha1^{note} in a tight loop, anyway, since sha1 expressions
like that generally come from the command line.

-Peff

      reply	other threads:[~2012-05-09 17:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-08 13:14 [PATCH] sha1_name: support sha1^{note} to return note sha-1 Nguyễn Thái Ngọc Duy
2012-05-08 16:11 ` Jeff King
2012-05-09  8:25   ` Nguyen Thai Ngoc Duy
2012-05-09 14:09     ` Johan Herland
2012-05-09 17:26       ` Jeff King [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=20120509172647.GA30487@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=johan@herland.net \
    --cc=pclouds@gmail.com \
    /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).