3 ms·
I'm pretty sure you are confusing Rust (borrowck, done at compile-time, no runtime overhead) and Swift (where every object is reference-counted, with some, some
by littlestymaar 7y ago
I'm pretty sure you are confusing Rust (borrowck, done at compile-time, no runtime overhead) and Swift (where every object is reference-counted, with some, sometimes big, overhead).
- pjmlp 7y agoIn Rust GUI code is quite common to have Rc<RefCell<>> scattered across all widgets callbacks.
- littlestymaar 7y agoI assume you're talking about GTK or Qt? AFAIK they are the only viable options for Rust GUI at the moment, but their paradigm doesn't fit well with Rust ownership and you need to use ref-counting everywhere as you said. I don't think the problem is inherent to GUI in general though.
- pjmlp 7y agoIt is, because Rust ergonomics for self referencial structs from closures require this type of dance. And when one cares about performance, creating/destructing hundreds of instances per frame like on reactive approaches, it isn't the best use of CPU cycles.