I think it depends alot on what breed, and size of the dog as well. I had a female retriever mix that went into her first heat at 4 1/2 months - she grew to be 110 pounds. (not sure what she was mixed with)
Tyr was altered at 5 months and probably should have been altered a little earlier. He started humping the living room pillows and my leg and other dogs at 4 months old. He started showing early signs of male aggression and it was suggested by his vet and his trainer to cut out all that testosterone. It worked! No more humping (well there are a few moments with large males that he feels he has to prove himself) And he doesn't have an agressive bone in his body!
With large breed males that are prone to male agression and/or wandering (huskies, wolf-hybrids, pits, Akitas.etc.) I say the earlier the better!!!
It will decrease the chances of aggression and the desire to wander.