Hi,
First thank you for this library !
I was doing some test and i find-out that Reactor arrays new Reactor([]) are really slow when using the sort method myReactor.sort on big Reactor arrays. For an array of 1000 items it take me ~ 30ms and for 5000 items it take me ~6800ms and this his exponential.
The same problem happened with Array.forEach and Array.map but duration is linear.
A workaround is to use shuck, Array.splice and Array.length like that :
const reactorArray = new Reactor([])
const newArray = shuck(reactorArray).sort();
reactorArray.length = 0; // without this line, the problem stay the same
reactorArray.splice(0, 0, ...newArray);
i have done a CodePen (https://codepen.io/sliverside/pen/yLZoJWJ) where you can see/modify/adapt my tests.
Thanks for your time !
Hi,
First thank you for this library !
I was doing some test and i find-out that Reactor arrays
new Reactor([])are really slow when using the sort methodmyReactor.sorton big Reactor arrays. For an array of 1000 items it take me ~ 30ms and for 5000 items it take me ~6800ms and this his exponential.The same problem happened with
Array.forEachandArray.mapbut duration is linear.A workaround is to use
shuck,Array.spliceandArray.lengthlike that :i have done a CodePen (https://codepen.io/sliverside/pen/yLZoJWJ) where you can see/modify/adapt my tests.
Thanks for your time !