Fast algorithm runs through fewer items in a loop, but still has timing issue