-
Notifications
You must be signed in to change notification settings - Fork 118
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
Support transforms for each widget #753
base: main
Are you sure you want to change the base?
Conversation
7da5c16
to
b97a9e9
Compare
pub fn iter(self) -> impl DoubleEndedIterator<Item = ArenaRef<'a, Item>> + ExactSizeIterator { | ||
self.children | ||
.iter() | ||
.map(move |child| child.arena_ref(self.id, self.parents_map.parents_map)) | ||
} |
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.
As I understand, this is added for performance reasons. #752 is another way to address those performance issues, but I wonder if we couldn't also solve them (in the safe TreeArena version) by having children
be a HashSet?
Then checking "X is child of Y" goes from O(N) to O(log(N)), which is still ridiculously inefficient, but good enough for our safe version.
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.
Yeah that's probably a good trade-off and at least avoids quadratic slowdown (which practically results in being completely "stuck" with big enough N
).
But I think you mean a HashMap
, i.e. something like children: HashMap<u64, TreeNode<Item>>
?
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.
Right, a hashmap.
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.
Ok, should this go into this PR? Or a separate PR, as I think it's somewhat orthogonal?
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.
We'll see after #752 merges. Probably a separate PR. Either way, I'd prefer if this PR didn't add an iter()
method.
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.
Sure, as I noted here (and in zulip) that this commit is temporary (a reason why I tried to isolate these changes, so that I can easily remove it again).
Alright then I'm waiting for the merger of #752 and implement it on top.
Checkout this zulip thread for more info/discussion.
This is far from the final state, and at this point should more serve for discussion.
See the xilem
mason
orhttp_cats
example, which I have abused to get an initial demo working.