From http://stackoverflow.com/questions/8547778/why-is-one-loop-so-much-slower-than-two-loops