It varies by category. If marriage to US citizen or USC's immediate relative, the sooner the better. for categories subject to visa numbers, longer wait doesn't hurt. And if there are derivatives children, the longer the I-130/I-140 process, the better chance children got protected from age-out.