-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Concat trait has bad codegen for arrays #82164
Copy link
Copy link
Open
Labels
A-arrayArea: `[T; N]`Area: `[T; N]`C-optimizationCategory: An issue highlighting optimization opportunities or PRs implementing suchCategory: An issue highlighting optimization opportunities or PRs implementing suchI-slowIssue: Problems and improvements with respect to performance of generated code.Issue: Problems and improvements with respect to performance of generated code.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-arrayArea: `[T; N]`Area: `[T; N]`C-optimizationCategory: An issue highlighting optimization opportunities or PRs implementing suchCategory: An issue highlighting optimization opportunities or PRs implementing suchI-slowIssue: Problems and improvements with respect to performance of generated code.Issue: Problems and improvements with respect to performance of generated code.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Code: https://rust.godbolt.org/z/TjPcbz
This shouldn't allocate. Nor should it be doing anywhere near as many copies. Even if you remove the Vec -> array conversion, it's still doing way more work than it needs to -- the grow calls should not be there for a simple concat.