From: Jeff King <peff@peff.net>
To: "René Scharfe" <rene.scharfe@lsrfire.ath.cx>
Cc: git@vger.kernel.org, "Junio C Hamano" <gitster@pobox.com>,
"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
"Jens Lehmann" <Jens.Lehmann@web.de>
Subject: Re: [PATCH 1/3] use struct sha1_array in diff_tree_combined()
Date: Sat, 17 Dec 2011 06:19:20 -0500 [thread overview]
Message-ID: <20111217111920.GA24917@sigill.intra.peff.net> (raw)
In-Reply-To: <4EEC7A10.3080705@lsrfire.ath.cx>
On Sat, Dec 17, 2011 at 12:16:32PM +0100, René Scharfe wrote:
> >The original code is slightly more efficient, as it is able to use a
> >single malloc (because it knows the number of entries ahead of time).
> >It probably doesn't make a difference, but we could also add a
> >sha1_array_grow() for this case.
> [...]
> We coulddo that, yes. In the case above we have the number already,
> in the other cases we'd have to count.
>
> But I don't think it's worth it here. ALLOC_GROW gives us 24 entries
> initially, which should be enough in most cases -- I'm not sure I
> want to see combined diff of that many tree. And 24 times 20 bytes
> is small enough to not cause any memory allocation issues.
You're right.
I was blindly looking at the conversion without thinking about the
context. Of course if you have just a few items, it's going to be
irrelevant (my initial refactoring of sha1_array was to help speed up a
hundreds-of-thousands of sha1s case, so I think that put me in the
mindset of a large list).
Sorry for the noise.
-Peff
prev parent reply other threads:[~2011-12-17 11:19 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-17 10:15 [PATCH 1/3] use struct sha1_array in diff_tree_combined() René Scharfe
2011-12-17 10:20 ` [PATCH 2/3] pass struct commit to diff_tree_combined_merge() René Scharfe
2011-12-17 10:27 ` [PATCH 3/3] submodule: use diff_tree_combined_merge() instead of diff_tree_combined() René Scharfe
2011-12-17 10:27 ` [PATCH 2/3] pass struct commit to diff_tree_combined_merge() René Scharfe
2011-12-17 10:27 ` [PATCH 1/3] use struct sha1_array in diff_tree_combined() René Scharfe
2011-12-17 10:53 ` Jeff King
2011-12-17 11:16 ` René Scharfe
2011-12-17 11:19 ` 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=20111217111920.GA24917@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=Jens.Lehmann@web.de \
--cc=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=rene.scharfe@lsrfire.ath.cx \
/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).