-
Notifications
You must be signed in to change notification settings - Fork 13k
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
std::thread::Thread
grew from one to two pointer sizes
#132619
Comments
std::thread::Thread
growing in sizestd::thread::Thread
grew from one to two pointer sizes
This performance regression (Thread inline size increasing) only affects code which handles std::thread::Thread, which is going to be much less than programs that hit the rt startup code which previously allocated for this, however this regression isn't impossible to claw back. Alignment tagging could possibly allow fitting the two pointers into a single one, via even more unsafe code, although that's more unsafe as a maintenance burden. |
Yes, unspecified layouts are unspecified and A benchmark that reflects an excerpt from an even vaguely practical program would be useful information, here, to measure any supposed regressions against. Or improvements, for that matter. When you start packing more data into the same eight bytes, it is very easy for packing more data in a smaller space to cost more instructions to actually act on that data. |
well, unstable implementation details may change at any time. |
Caused by the changes in #123550 the size of
std::thread::Thread
grew from one to two pointer sizes.The docs don't promise
Thread
to have a certain size so I'm not quite sure whether this would be considered a breaking change. It doesn't seem however like this was noticed/acknowledged in the PR, as having a larger thread handle might negate the benefits that PR brought with it.Code
I tried this code:
I expected to see this happen: it to run successfully
Instead, this happened: the assert is unfulfilled and it panics
Version it worked on
It most recently worked on: Rust 1.82
Version with regression
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: