perf(git): drop intermediate Vec in format_command join (#4153) - #4204
Closed
wuisabel-gif wants to merge 1 commit into
Closed
perf(git): drop intermediate Vec in format_command join (#4153)#4204wuisabel-gif wants to merge 1 commit into
wuisabel-gif wants to merge 1 commit into
Conversation
Contributor
|
Thanks @wuisabel-gif for taking the time to contribute. This repository is observing a maintainer-managed PR intake gate in dry-run mode, so this pull request is staying open. This note helps maintainers prepare the allowlist before any enforcement is considered. Please read |
format_command collected args into a Vec<&str> only to join it. Since
args is &[String], <[String]>::join(" ") does the same with no
intermediate allocation and identical output.
finance.rs (the other candidate site) is left as-is: its summary()
returns owned String, so joining requires materializing the Vec and no
std Iterator::join exists to remove it.
wuisabel-gif
force-pushed
the
fix/4153-collect-join
branch
from
July 8, 2026 07:12
2fe3867 to
582f9e4
Compare
Owner
Closed
83 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #4153 (v0.8.68 §6.7 / B3.3 — remove collect before join allocations).
What
format_commandincrates/tui/src/tools/git.rscollectedargsinto aVec<&str>purely to.join(" ")it. Sinceargsis&[String],<[String]>::join(" ")does the same directly with no intermediateallocation and byte-identical output.
finance.rs left as-is
The issue also lists
finance.rs, but its site mapsAttemptFailure::summary()which returns an ownedString. There is noIterator::joinin std, so joining requires materializing theVecfirst — the allocation is not unnecessary there. Per the acceptance
note ("where type constraints allow it"), that site is unchanged.
Verification
Output is unchanged. Verified the idiom compiles and the new expression
produces identical output to the old one: