5 ms·
Sure, but this article is comparing two data structures which have the same big O complexity for the operation, O(N), and the comparison is about the relative p
by cesaref 4y ago
Sure, but this article is comparing two data structures which have the same big O complexity for the operation, O(N), and the comparison is about the relative performance of the two.
My point is that worrying about this for a code path that only happens once at startup is silly, but in the main loop of a critical performance code path, then sure, go ahead. The mistake would be to use vectors all over the place instead of lists 'because linked lists are slow' when they have other benefits (e.g. cost of insertion, address of elements don't change etc) which may adversely affect the readability of the surrounding code if you by default use vectors.
Anyhow, just my opinion of course.