From: Stefan Saasen <ssaasen@atlassian.com>
To: Jeff King <peff@peff.net>
Cc: Junio C Hamano <gitster@pobox.com>,
Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH 1/2] sha1_file: freshen pack objects before loose
Date: Tue, 21 Apr 2015 10:46:25 +1000 [thread overview]
Message-ID: <CADoxLGPNEjDWBjsYn30acapCUj6TfMw5z34W6f_9OjhXySFMLQ@mail.gmail.com> (raw)
In-Reply-To: <20150420195403.GA15760@peff.net>
I didn't expect anything else (as the patch is the same as the
previous one) but I verified that applying this patch has the desired
effect (https://bitbucket.org/snippets/ssaasen/9AXg).
Thanks for the fix Jeff.
On 21 April 2015 at 05:54, Jeff King <peff@peff.net> wrote:
> When writing out an object file, we first check whether it
> already exists and if so optimize out the write. Prior to
> 33d4221, we did this by calling has_sha1_file(), which will
> check for packed objects followed by loose. Since that
> commit, we check loose objects first.
>
> For the common case of a repository whose objects are mostly
> packed, this means we will make a lot of extra access()
> system calls checking for loose objects. We should follow
> the same packed-then-loose order that all of our other
> lookups use.
>
> Reported-by: Stefan Saasen <ssaasen@atlassian.com>
> Signed-off-by: Jeff King <peff@peff.net>
> ---
> sha1_file.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/sha1_file.c b/sha1_file.c
> index 88f06ba..822aaef 100644
> --- a/sha1_file.c
> +++ b/sha1_file.c
> @@ -3014,7 +3014,7 @@ int write_sha1_file(const void *buf, unsigned long len, const char *type, unsign
> write_sha1_file_prepare(buf, len, type, sha1, hdr, &hdrlen);
> if (returnsha1)
> hashcpy(returnsha1, sha1);
> - if (freshen_loose_object(sha1) || freshen_packed_object(sha1))
> + if (freshen_packed_object(sha1) || freshen_loose_object(sha1))
> return 0;
> return write_loose_object(sha1, hdr, hdrlen, buf, len, 0);
> }
> --
> 2.4.0.rc2.384.g7297a4a
>
next prev parent reply other threads:[~2015-04-21 0:47 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-17 7:30 [BUG] Performance regression due to #33d4221: write_sha1_file: freshen existing objects Stefan Saasen
2015-04-17 14:03 ` Jeff King
2015-04-17 15:50 ` Junio C Hamano
2015-04-18 3:35 ` Stefan Saasen
2015-04-20 19:53 ` Jeff King
2015-04-20 19:54 ` [PATCH 1/2] sha1_file: freshen pack objects before loose Jeff King
2015-04-21 0:46 ` Stefan Saasen [this message]
2015-04-20 19:55 ` [PATCH 2/2] sha1_file: only freshen packs once per run Jeff King
2015-04-21 0:45 ` Stefan Saasen
2015-04-20 20:04 ` [BUG] Performance regression due to #33d4221: write_sha1_file: freshen existing objects Junio C Hamano
2015-04-20 20:09 ` Jeff King
2015-04-20 20:12 ` Junio C Hamano
2015-04-20 20:28 ` Jeff King
2015-04-21 1:49 ` Stefan Saasen
2015-04-21 17:05 ` Junio C Hamano
2015-04-21 21:45 ` Junio C Hamano
2015-04-22 1:46 ` Stefan Saasen
2015-04-22 22:00 ` Junio C Hamano
2015-04-22 0:04 ` Stefan Saasen
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=CADoxLGPNEjDWBjsYn30acapCUj6TfMw5z34W6f_9OjhXySFMLQ@mail.gmail.com \
--to=ssaasen@atlassian.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--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 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).