News for hackers. Stuff that matters.
Re:New Grad vs. Senior Dev by michaelchisari on Sunday March 29, 2020 @06:41AM (#22717852)
This is key. If the number of objects processed will never be large, then it makes more sense to write a quick, easily understood O(n^2) loop in under a minute and move on.

Taking an extra 30 minutes to an hour or longer to optimize and test for large inputs that will realistically never exist is a waste of time and money.

If you feel that the value of N might, in some strange and rare combination of success and changed requirements, exceed the expected amount, add a check for the lowest value that may signify a problem and throw a warning.

  if N > 1000:
    debug.warn("N count of %d may be too large for existing algorithm. Consider optimizing.", N)
Leave it at that and get on to more important things.

There are no comments on this comment yet.