-
Notifications
You must be signed in to change notification settings - Fork 22
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
Add Copy
to some structs
#1332
Comments
I didn't realize this happens. Very good catch! We'll definitely look into this. It's a shame rustc optimizes non- |
Opened an issue. |
rust-lang/rust#128081 (comment) was fixed, at least in significant part, by rust-lang/rust#128299, so we should check if this is still an issue for our types. |
This should land in 1.83 on 2024-11-28, so we should just wait until then and upgrade our toolchain. |
rust-lang/rust#132356 disabled the optimization, should wait to be fixed. |
Godbolt Link
As you can see in the asm output, even set
opt-level = 3
, if we don't addCopy
to structs with all fieldsCopy
derived, inclone()
it generates moremov
and large struct can't triggermemcpy
, I suggest to addCopy
to them to alleviate binary size bloated and performance problem.List of structs that could add
Copy
(Simple search may miss):The text was updated successfully, but these errors were encountered: