-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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: consider leaf nodes to have empty edges #77025
Conversation
Some of the stuff split off into #77005. The rest is a little disappointing. The only way I found to make gdb_providers work is obnoxious. I couldn't python to access the Performance of insertion may be better for reasonably sized key/values.
|
ec77ae3
to
0a96e95
Compare
Found tricks to simplify the gdb introspection. The result is still a bit disappointing but acceptable to me. |
I'll wait for #77005 to land before going ahead to review this. |
And I'll wait for #77005 to land to rebase. |
3479bf6
to
3ed17fb
Compare
impl<K, V, E> UniversalNode<K, V, E> { | ||
/// Creates a new `Node`. Unsafe because all nodes should really be hidden behind | ||
/// `BoxedNode`, preventing accidental dropping of uninitialized keys and values. | ||
unsafe fn new() -> Box<Self> { |
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.
I think the unsafe (that I transplanted from LeafNode::new
) is silly. The function does nothing unsafe. The value returned does not own any keys or values yet. I'm pretty sure that after wrapping it in BoxedNode
, you could still wreak havoc without invoking any unsafe function.
3ed17fb
to
553d129
Compare
Hm, so I'm not sure this is a win. The node code is already pretty scattered (at least in my mind) -- and introducing another type parameter that readers need to figure out feels pretty bad, especially because it doesn't look like it really cleans anything up in a major way, just introduces additional indirection (at the type-level, at least). Can you say more about the motivation for this? Perhaps there's an end goal in mind here that I'm not yet seeing? |
The motivation is in this PR's description. The first point can be covered by adapting comments, the second point is somewhat addressed by the |
Or very concretely, if you try to treat edges in the
you end up realizing that the debug_assert in |
Failing to find ways to make this more appealing |
…mments, r=Mark-Simulacrum BTreeMap: admit the existence of leaf edges in comments The btree code is ambiguous about leaf edges (i.e., edges within leaf nodes). Iteration relies on them heavily, but some of the comments suggest there are no leaf edges (extracted from rust-lang#77025) r? @Mark-Simulacrum
Tried to make internal and leaf nodes more alike, because:
r? @Mark-Simulacrum