This little loop was causing performance issues for me.
For a collection of 1517 items. With an empty cache, render time was about 1800ms. When the cache was filled, render time was 4000ms! With this change, i brought it down to less than 40ms.
I suspect that the .delete call is the cause of this. The searching and removing of the element is both O(n). This issue might also have been solved by using a Set for the collection, but i haven't tried that.
This little loop was causing performance issues for me.
For a collection of 1517 items. With an empty cache, render time was about 1800ms. When the cache was filled, render time was 4000ms! With this change, i brought it down to less than 40ms.
I suspect that the .delete call is the cause of this. The searching and removing of the element is both O(n). This issue might also have been solved by using a Set for the collection, but i haven't tried that.