Skip to content

libutil/tarfile: Create the scratch std::vector only once (backport #13175)#13577

Merged
mergify[bot] merged 1 commit into2.28-maintenancefrom
mergify/bp/2.28-maintenance/pr-13175
Jul 30, 2025
Merged

libutil/tarfile: Create the scratch std::vector only once (backport #13175)#13577
mergify[bot] merged 1 commit into2.28-maintenancefrom
mergify/bp/2.28-maintenance/pr-13175

Conversation

@mergify
Copy link
Contributor

@mergify mergify bot commented Jul 30, 2025

Motivation

AFAICT there is no reason to keep a copy of the data since it always gets fed into the sink and there are no coroutines/threads in sight.

I can't find a good way to benchmark in isolation from the git cache, but common sense dictates that creating (and destroying) a 131KiB std::vector for each 131KiB chunk of a regular file from the archive imposes quite a significant overhead regardless of the IO bound git cache.

cc @edolstra git blame points me to #9485 for when this was first introduced. Since then code was moved quite a bit by @Ericson2314. Is there some reason this was done this way and stuff just got lost during refactorings?

Context

Should help a bit with #10683


Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.


This is an automatic backport of pull request #13175 done by [Mergify](https://mergify.com).

I can't find a good way to benchmark in isolation from the
git cache, but common sense dictates that creating (and destroying)
a 131KiB std::vector for each regular file from the archive imposes
quite a significant overhead regardless of the IO bound git cache.

AFAICT there is no reason to keep a copy of the data since
it always gets fed into the sink and there are no coroutines/threads
in sight.

(cherry picked from commit 7628155)
@mergify mergify bot added automatic backport This PR is a backport produced by automation (does not trigger backporting) merge-queue labels Jul 30, 2025
@mergify mergify bot requested a review from edolstra as a code owner July 30, 2025 11:32
@mergify mergify bot added merge-queue automatic backport This PR is a backport produced by automation (does not trigger backporting) labels Jul 30, 2025
@mergify mergify bot merged commit 0d763f7 into 2.28-maintenance Jul 30, 2025
27 checks passed
@mergify mergify bot deleted the mergify/bp/2.28-maintenance/pr-13175 branch July 30, 2025 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automatic backport This PR is a backport produced by automation (does not trigger backporting) merge-queue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant