Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

destructuring_assignment fails to optimize code as well as mem::swap #90699

Open
veber-alex opened this issue Nov 8, 2021 · 0 comments
Open
Labels
C-bug Category: This is a bug. F-destructuring_assignment `#![feature(destructuring_assignment)]` I-slow Issue: Problems and improvements with respect to performance of generated code.

Comments

@veber-alex
Copy link
Contributor

Opening a new bug as requested in #90521 (comment)

I wanted to check how (a,b) = (b,a) compares to mem::swap, it looks like mem::swap applies optimizations when T is 32 bytes or bigger but destructuring_assignment doesn't.

I tried this code:
https://godbolt.org/z/czfTv3nzW

I expected to see this happen:
Both function should generate the same (optimal) code

Instead, this happened:
mem::swap applies optimizations while destructuring_assignment doesn't

@veber-alex veber-alex added the C-bug Category: This is a bug. label Nov 8, 2021
@fee1-dead fee1-dead added the I-slow Issue: Problems and improvements with respect to performance of generated code. label Nov 8, 2021
@varkor varkor added the F-destructuring_assignment `#![feature(destructuring_assignment)]` label Nov 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. F-destructuring_assignment `#![feature(destructuring_assignment)]` I-slow Issue: Problems and improvements with respect to performance of generated code.
Projects
None yet
Development

No branches or pull requests

3 participants