2 ms·
There is a difference between doing the right thing for efficiency, and going out of your way to make things as fast as possible. Storing 1k entries in an O(n)
by qwertyuiop924 10y ago
There is a difference between doing the right thing for efficiency, and going out of your way to make things as fast as possible. Storing 1k entries in an O(n) datastructure is an example of not doing the former, and using your language's built-in hashmap type, instead of implementing your own, using domain-specific knowledge to optimize it within an inch of life, is an example of the ladder.
Don't write code you know will be too slow, but don't optimize the code just because you can. By the same token, if you find out that your code is too slow, it's your job to optimize it.
Take performance seriously, but don't optimize before you know why you're optimizing.