3 ms·
>in a 2020 machine with a normal workload I have yet to see a list outperform a contiguous array outside of pathological cases I guess an size(array)+1 is a pa
by konjin 6y ago
>in a 2020 machine with a normal workload I have yet to see a list outperform a contiguous array outside of pathological cases
I guess an size(array)+1 is a pathological case. Shame it seems to happen in every code base I've looked at.
- jcelerier 6y agothe 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).