Skip to content
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

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

Philipp-M
Copy link
Contributor

@Philipp-M Philipp-M commented Nov 18, 2024

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 or http_cats example, which I have abused to get an initial demo working.

@KGrewal1 KGrewal1 mentioned this pull request Nov 27, 2024
Comment on lines +271 to +275
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))
}
Copy link
Contributor

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.

Copy link
Contributor Author

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>>?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, a hashmap.

Copy link
Contributor Author

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?

Copy link
Contributor

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.

Copy link
Contributor Author

@Philipp-M Philipp-M Nov 29, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants