All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: "René Scharfe" <l.s.r@web.de>, "Git List" <git@vger.kernel.org>,
	"Jonathan Tan" <jonathantanmy@google.com>
Subject: Re: [PATCH 1/2] sha1_file: drop experimental GIT_USE_LOOKUP search
Date: Wed, 09 Aug 2017 11:12:19 -0700	[thread overview]
Message-ID: <xmqqshh06264.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20170809101432.6jquwmev423o56pb@sigill.intra.peff.net> (Jeff King's message of "Wed, 9 Aug 2017 06:14:32 -0400")

Jeff King <peff@peff.net> writes:

> This lets us remove sha1_entry_pos() entirely, as the .idx
> lookup code was the only caller.  Note that sha1-lookup.c
> still contains sha1_pos(), which differs from
> sha1_entry_pos() in two ways:
>
>   - it has a different interface; it uses a function pointer
>     to access sha1 entries rather than a size/offset pair
>     describing the table's memory layout
>
>   - it only scales the initial selection of "mi", rather
>     than each iteration of the search
>
> We can't get rid of this function, as it's called from
> several places. It may be that we could replace it with a
> simple binary search, but that's out of scope for this patch
> (and would need benchmarking).

Thanks for reducing the count of binary search functions by one.

I think the "just one round of newton-raphson" in sha1_pos() comes
from [*1*]; I agree that it needs benchmarking before tweaking it.

We may want to tell libgit2 folks about this change, though [*2*].
I think they too are carrying dead code that is only used under CPP
macro GIT_USE_LOOKUP, which they do not seem to define.


[Reference]

*1* https://public-inbox.org/git/7v38vso8kz.fsf@alter.siamese.dyndns.org/
*2* https://github.com/libgit2/libgit2/commit/dd453c4dbf9a1fa38530b1f51e079852736b8f66

  reply	other threads:[~2017-08-09 18:12 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-08 22:07 [PATCH] sha1_file: avoid comparison if no packed hash matches the first byte René Scharfe
2017-08-08 22:41 ` Jonathan Nieder
2017-08-08 22:43 ` Junio C Hamano
2017-08-08 22:52   ` Jeff King
2017-08-08 22:58     ` Jeff King
2017-08-09  5:36       ` Junio C Hamano
2017-08-09  9:20         ` Jeff King
2017-08-09 10:11           ` Jeff King
2017-08-09 10:14             ` [PATCH 1/2] sha1_file: drop experimental GIT_USE_LOOKUP search Jeff King
2017-08-09 18:12               ` Junio C Hamano [this message]
2017-08-09 21:09                 ` Jeff King
2017-08-09 10:16             ` [PATCH 2/2] hashcmp: use memcmp instead of open-coded loop Jeff King
2017-08-09 14:55               ` René Scharfe
2017-08-09 15:06                 ` Jeff King

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=xmqqshh06264.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=jonathantanmy@google.com \
    --cc=l.s.r@web.de \
    --cc=peff@peff.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.