3 ms·
I've been following dioxus with interest despite not having a chance to use it yet. However I'm a bit perplexed with the solution to remove lifetimes [0]. Isn'
by KolmogorovComp 3y ago
I've been following dioxus with interest despite not having a chance to use it yet.
However I'm a bit perplexed with the solution to remove lifetimes [0]. Isn't it a poor's-man GC? What was the performance impact?
[0]: https://crates.io/crates/generational-box https://crates.io/crates/generational-box
Side-note: `[generational-box](https://crates.io/crates/generational-box https://crates.io/crates/generational-box)` link is broken
- jkelleyrtp 3y agoIt is poor man's GC, but the memory semantics are exactly the same as the previous version. Since `use_hook` owns a value for the lifetime of the component, that value is dropped when the component drops. All signals still `use_hook` so their lifetimes are the same. No performance impact whatsoever since we generally discourage calling `GenerationalBox::new()` outside of use_hook. Now if you spammed `GenerationalBox::new()` in a loop or something, yeah, your garbage will exist until the component drops. But most of the time folks will just push/pop from a Map or a Vec and regular memory semantics apply.
- ramesh31 3y ago>However I'm a bit perplexed with the solution to remove lifetimes [0]. Isn't it a poor's-man GC? This is essentially just ARC: https://en.wikipedia.org/wiki/Automatic_Reference_Counting https://en.wikipedia.org/wiki/Automatic_Reference_Counting
- sirwhinesalot 3y agoRust's Arc is like ARC, this is more like a generational pool of Box<dyn Any>.