Backport WorkerLocal#155649
Conversation
|
rustbot has assigned @nikomatsakis. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
I'd just copy over the whole new file to keep the updated safety comments and microoptimizations, then just change it to share just the Registry type, so it doesn't make use of |
|
If I did that I would copy old code back due to this registry struct. I've copied all of the safety comments and microoptimizations. The aforementioned null check is unavoidable as it is done for |
ee414f8 to
6eaa913
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
@Zoxc (do you want to take this review, or should I?) |
#107782 added a
WorkerLocalinto rustc_data_structures. Due to it being ported from the old rustc rayon fork it required also portingRegistryand sort of hack it in there. This PR replaces new version with the old one while trying to backport whatever microoptimizations were added. But I doubt #107782's manual benchmarks as those aren't significantly big to differentiate from the noise, although that's from my experience.One difference I haven't yet addressed is an indirection through thread-local
WORKER_THREAD_STATEpointer. I've found that changing its type toManuallyDrop<OnceCell<WorkerThread>>itself is essentially a clean up/refactor which I've stashed for now.cc @Zoxc