Do these questions belong on SO or [Code Review][1]? I would say Code Review, since it is for improving the code, but... [![meme][2]][2] thus I felt I should ask. Stimulus: https://stackoverflow.com/questions/36221561/how-can-i-change-this-code-to-be-more-efficient [1]: https://codereview.stackexchange.com/ [2]: https://i.sstatic.net/m8r8L.jpg