3 ms·
IMO, premature optimization doesn't apply to cases where you are making general decisions about policy or defaults, otherwise you can get into a "death by a tho
by mantap 7y ago
IMO, premature optimization doesn't apply to cases where you are making general decisions about policy or defaults, otherwise you can get into a "death by a thousand cuts" situation where none of your functions are slow individually but the whole program is slow (i.e. big overheads). To me, premature optimization means don't optimize a specific function unless you know it is slow. I'd also say that premature optimization doesn't apply in cases where both alternatives are equally easy to write.
- mlyle 7y agoOn the other hand, if you pick a TreeMap--- odds are it will be a non-issue either way. If it does show up on your profiles, it's easy to reconsider and say "I don't think I'll ever access this in order, after all..." and change it and see if you see a benefit.
- JadeNB 7y ago> I'd also say that premature optimization doesn't apply in cases where both alternatives are equally easy to write. I think that premature optimisation applies not only to ease of writing, but even more to ease of debugging.
- unethical_ban 7y agoPrematurely optimizing for death by a thousand cuts is what you're proposing.