2 ms·
the question is, how often does it happen when compared to iterating over your loop ? Like, every codebase I've worked on had some array sorting at some point
by jcelerier 6y ago
the question is, how often does it happen when compared to iterating over your loop ?
Like, every codebase I've worked on had some array sorting at some point in it... but the frequency of needing to sort something vs having to loop over all the X makes it a completely not-relevant thing.
If the only time you add an element to an array is as a result of the user clicking somewhere, then I'd say it's definitely not worth taking into account if your array isn't 5000000 elements (which it will likely won't be if you are giving the user the ability to just add something to it).