In the sprite rendering code there is an if statement in the inner loop that check if the entire sprite is collisionIndex 0. This if statement could be checked before even entering the inner loop.