viridia / quill

A reactive UI framework for Bevy
Apache License 2.0
125 stars 12 forks source link

Explore alternate designs for iterator lifetimes in ForEach. #10

Open viridia opened 3 months ago

viridia commented 3 months ago

Currently ForEach accepts an iterator, and it needs to own that iterator. This means that under many circumstances the entire array is cloned; worse, it gets copied twice (once when passed as a parameter to ForEach, and a second time internally within ForEach when the iterator is actually iterated).

It's possible that there may be a more efficient approach that involves fewer clones; I'm not sure if this is possible or not. Here are some facts about ForEach: