Re:Ropes, an Alternative to Strings [pdf] (1995)
by jcelerier on Monday November 02, 2020 @04:32AM
(#24966182)
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).
I guess an size(array)+1 is a pathological case. Shame it seems to happen in every code base I've looked at.