-
Notifications
You must be signed in to change notification settings - Fork 140
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
1. Change the inspector to a virtual list. #715
Conversation
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.
What is the motivation for making this change?
fn total(&self) -> usize { | ||
match &self.ty { | ||
DataType::Internal { expanded, children } => { | ||
if expanded.get() { | ||
let mut total = 1; | ||
for child in children { | ||
total += child.total(); | ||
} | ||
total | ||
} else { | ||
1 | ||
} | ||
} | ||
DataType::Leaf => 1, | ||
} | ||
} | ||
|
||
fn get_children( | ||
&self, | ||
next: &mut usize, | ||
min: usize, | ||
max: usize, | ||
level: usize, | ||
) -> Vec<(usize, usize, CapturedData)> { |
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.
It looks like both of these functions are relatively expensive to compute. Is there a reason that these aren't just computed and stored in the init function? Then the get children function could just return a slice without needing to build a new vec of children elements.
After upgrading Floem to version 0.2.0, using the inspector causes the program to overflow.
As far as I know, a virtual list is relatively inexpensive and dynamically calculated. Additionally, the example of the virtual list is overly simplistic. |
I should've tested it first. I thought this would be slower than the old way with rebuilding a list of items every time the list refreshes but it's definitely faster. |
No description provided.