Skip to content

Remove the Arc rt::init allocation for thread info#123550

Merged
bors merged 1 commit intorust-lang:masterfrom
GnomedDev:remove-initial-arc
Oct 24, 2024
Merged

Remove the Arc rt::init allocation for thread info#123550
bors merged 1 commit intorust-lang:masterfrom
GnomedDev:remove-initial-arc

Conversation

@GnomedDev
Copy link
Contributor

@GnomedDev GnomedDev commented Apr 6, 2024

Removes an allocation pre-main by just not storing anything in std::thread::Thread for the main thread.

  • The thread name can just be a hard coded literal, as was done in Remove rt::init allocation for thread name #123433.
  • Storing ThreadId and Parker in a static that is initialized once at startup. This uses SyncUnsafeCell and MaybeUninit as this is quite performance critical and we don't need synchronization or to store a tag value and possibly leave in a panic.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.