From: Jeff King <peff@peff.net>
To: Victoria Dye <vdye@github.com>
Cc: Junio C Hamano <gitster@pobox.com>,
git@vger.kernel.org, Phillip Wood <phillip.wood123@gmail.com>
Subject: Re: [PATCH 2/3] read-cache: read on-disk entries in byte order
Date: Thu, 29 Sep 2022 07:27:14 -0400 [thread overview]
Message-ID: <YzWBEoRkCmbUkIs8@coredump.intra.peff.net> (raw)
In-Reply-To: <YzPLuizoOlDuPu4G@coredump.intra.peff.net>
On Wed, Sep 28, 2022 at 12:21:15AM -0400, Jeff King wrote:
> The downside is that we're copying the data an extra time. It's not very
> much data, and it's all fixed size, so the compiler should be able to do
> a reasonable job of optimizing here. But I didn't time the potential
> impact.
I timed this using "test-tool read-cache". It's kind of an artificial
benchmark, but it does isolate the code we're touching here. The results
are...not good. Here's the time to read the index of linux.git 1000
times, before and after this reordering patch:
Benchmark 1: ./test-tool.old read-cache 1000
Time (mean ± σ): 2.870 s ± 0.073 s [User: 2.555 s, System: 0.315 s]
Range (min … max): 2.789 s … 3.001 s 10 runs
Benchmark 2: ./test-tool.new read-cache 1000
Time (mean ± σ): 3.180 s ± 0.080 s [User: 2.849 s, System: 0.331 s]
Range (min … max): 3.092 s … 3.297 s 10 runs
Summary
'./test-tool.old read-cache 1000' ran
1.11 ± 0.04 times faster than './test-tool.new read-cache 1000'
I think that's probably the nail in the coffin for my proposed approach.
To be fair, it's only .3ms extra for a normal program which reads the
index once. That's not that big in absolute numbers. But there are
larger index files in the wild. And the improvement in simplicity and
readability is simply not that great.
-Peff
next prev parent reply other threads:[~2022-09-29 11:27 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-27 21:11 What's cooking in git.git (Sep 2022, #08; Tue, 27) Junio C Hamano
2022-09-28 1:52 ` Victoria Dye
2022-09-28 4:18 ` vd/fix-unaligned-read-index-v4, was " Jeff King
2022-09-28 4:19 ` [PATCH 1/3] pack-bitmap: make read_be32() public Jeff King
2022-09-28 4:21 ` [PATCH 2/3] read-cache: read on-disk entries in byte order Jeff King
2022-09-29 11:27 ` Jeff King [this message]
2022-09-29 15:47 ` Junio C Hamano
2022-09-28 4:23 ` [PATCH 3/3] read-cache: use read_be32() in create_from_disk() Jeff King
2022-09-28 16:41 ` vd/fix-unaligned-read-index-v4, was Re: What's cooking in git.git (Sep 2022, #08; Tue, 27) Junio C Hamano
2022-09-28 17:01 ` Ævar Arnfjörð Bjarmason
2022-09-28 17:41 ` Junio C Hamano
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=YzWBEoRkCmbUkIs8@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=phillip.wood123@gmail.com \
--cc=vdye@github.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).