-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
BTreeMap: reuse BoxedNode instances directly instead of their contents #77408
Conversation
Benchmarks pretend to be a bit faster, despite push/pop being relatively rare.
|
BoxedNode::from_ptr( | ||
self.node_as_mut().cast_unchecked::<marker::Internal>().first_edge().descend().node, | ||
) | ||
mem::replace(&mut internal_node.edges[0], MaybeUninit::uninit()).assume_init() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels like we're (potentially) doing needless work -- this looks equivalent to internal_node.edges[0].assume_init_read()
which avoids the spurious write to edges -- can we use that instead?
(I suspect in practice LLVM probably ignores writing uninitialized data to some region of memory, but not sure).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed and I did the logical equivalent ptr::read on the other side.
26eab33
to
8d82850
Compare
Swapped the 2 commits here and based on #77471 to avoid a benign conflict |
8d82850
to
1a3f80c
Compare
Nothing wrong, just easier to follow if I do the first commit separately. |
1a3f80c
to
167495c
Compare
…ulacrum BTreeMap: type-specific variants of node_as_mut and cast_unchecked Improves debug checking and shortens some expressions. Extracted from rust-lang#77408
…ulacrum BTreeMap: type-specific variants of node_as_mut and cast_unchecked Improves debug checking and shortens some expressions. Extracted from rust-lang#77408
…ulacrum BTreeMap: type-specific variants of node_as_mut and cast_unchecked Improves debug checking and shortens some expressions. Extracted from rust-lang#77408
167495c
to
184735a
Compare
Still showing the same improvement, but now with the opposite on sets.
|
@rustbot modify labels: +S-waiting-on-review -S-waiting-on-author |
@bors r+ rollup=never |
📌 Commit 184735a has been approved by |
Okay. I don't mind the extra PR. @bors r+ |
📌 Commit 184735a has been approved by |
⌛ Testing commit 184735a with merge 8682c9fe0f1a3307f310ee5e5b4a66f93c5f9466... |
r? @Mark-Simulacrum