Open
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.
Metadata
Metadata
Assignees
Labels
Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlArea: `[T; N]`Category: An issue proposing an enhancement or a PR with one.Issue: Problems and improvements with respect to performance of generated code.Relevant to the compiler team, which will review and decide on the PR/issue.