3 ms·
>Number one is probably no Big-O performance considerations, or Big-O is an afterthought. For the love of God, please please please don't do a linear search on
by crdoconnor 9y ago
>Number one is probably no Big-O performance considerations, or Big-O is an afterthought. For the love of God, please please please don't do a linear search on an unsorted array anywhere inside a nested loop. If you're going to do any appreciable number of lookups, preprocess your data into a hashmap, hashset, whatever.
Big O should be an afterthought - the MO of any developer ought to be to get it right and then refactor - and worry about speed after profiling. Premature optimization is an antipattern you should be selecting against, not for.
- dozzie 9y agoNo. Leaving landmines like an easily avoidable linear search in a loop is an antipattern.