-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-MIRArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlA-arrayArea: `[T; N]`Area: `[T; N]`C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.I-slowIssue: Problems and improvements with respect to performance of generated code.Issue: Problems and improvements with respect to performance of generated code.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Right now when you push an immediate we construct a temporary copy on the stack and then move it into place on the heap. This is wasteful and results in a good deal of code bloat. Can we do better (with MIR perhaps)?
One possible sketch of a solution is to implement MIR inlining and then use some variant of #32966 that can prove that the construction of the argument to push()
does not touch the vector, enabling us to forward the move from the stack to the destination of ptr::write()
.
An alternative would be to implement rust-lang/rfcs#1426.
est31, LooMaclin, ruuda, bluss, frol and 2 more
Metadata
Metadata
Assignees
Labels
A-MIRArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlA-arrayArea: `[T; N]`Area: `[T; N]`C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.I-slowIssue: Problems and improvements with respect to performance of generated code.Issue: Problems and improvements with respect to performance of generated code.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.