]> git.ipfire.org Git - thirdparty/git.git/commit
reftable/reader: avoid copying index iterator
authorPatrick Steinhardt <ps@pks.im>
Mon, 13 May 2024 08:47:06 +0000 (10:47 +0200)
committerJunio C Hamano <gitster@pobox.com>
Tue, 14 May 2024 00:04:16 +0000 (17:04 -0700)
commit9a59b65dba0820671753f636e9417bfd63ea20c1
treef0b817c0327ce534b1f2f4d9ead921731467e657
parentd537ce6b9ed75d50c6b8ad071439b06c1b70c5f8
reftable/reader: avoid copying index iterator

When doing an indexed seek we need to walk down the multi-level index
until we finally hit a record of the desired indexed type. This loop
performs a copy of the index iterator on every iteration, which is both
hard to understand and completely unnecessary.

Refactor the code so that we use a single iterator to walk down the
indices, only.

Note that while this should improve performance, the improvement is
negligible in all but the most unreasonable repositories. This is
because the effect is only really noticeable when we have to walk down
many levels of indices, which is not something that a repository would
typically have. So the motivation for this change is really only about
readability.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
reftable/reader.c