re: Refactoring the Worst Code I’ve Ever Written VIEW POST

TOP OF THREAD FULL DISCUSSION
re: But nested loops can have significant negative performance impacts. This method focuses on each layer of categorization separately, eliminating ext...
 

Thanks for the comment! I'm aware that nested loops aren't always a bad thing, that's why I included the word "can" in the part of my article you quoted. :)

In this case, you're right, the nested loop is faster, so I stand corrected on the claim that the solution I proposed is better for performance. Most "best practice" articles/guides I've read have all suggested to stay away from nested loops when possible, so I opted to highlight a different method. Of course it's all context specific, so the "best" way is going to be variable depending on the problem being solved.

In any case, I've updated my article with a link to your comment so others can see it as well. Thanks!

code of conduct - report abuse