3 ms·
While we should avoid premature optimizations, it is quite important to keep efficiency considerations in mind from the beginning. If we are talking about inte
by xixi77 13y ago
While we should avoid premature optimizations, it is quite important to keep efficiency considerations in mind from the beginning.
If we are talking about internal workings of one isolated function, fine -- but quite often a data structure picked "with no eye on efficiency" early on gets baked into the rest of the code so deep that by the time it becomes a problem, only extensive refactoring and debugging can get it out of there. And quite often the error-proneness of the more efficient data structure is no worse -- the classic structure-of-arrays vs. array-of-structures question is one example.