BTreeMap: consider leaf nodes to have empty edges#77025
BTreeMap: consider leaf nodes to have empty edges#77025ssomers wants to merge 1 commit intorust-lang:masterfrom ssomers:btree_NodeTypeTrait
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. |
|
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. |
There was a problem hiding this comment.
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.
|
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