I agree with Guennael, it makes sense to prepare in advance, as there is a relevant amount of preparation to do before interviews (100-150 hours) and it is quite unfeasible to find so much time between the invitation and the interview (although it is often possible to reschedule the interview).
But there is also another reason why starting the preparation in advance can be useful - in this way you are committing to secure an interview. Let me explain.
If you plan to start preparing after you have an invitation, you are telling yourself you are not really sure you are going to receive it in the first place. This will also unintentionally decrease your attachment to the outcome, as you won't be fully invested in obtaining your goal.
If you start to invest time and money on your preparation in advanced, instead, you are creating a sunk cost you won't recoup if you don't succeed. This will make you more likely to succeed, simply because you don't want to lose what you already invested in (in psychology this is called the sunk-cost bias). From a practical point of view, this may push you to invest more time in your CV and Cover preparation, 2nd tier referrals, better MBB referral, or anything else that can maximize the fact you are called for an interview.
The extreme case is when the only option for you is to succeed - think about Cortes destroying his ships. Overall this won't guarantee success but will maximize your chances to indeed be successful.
To directly answer your question, as for personal experience based on the people I helped in securing offers, the best results are achieved by those who start the preparation at least 2-3 months before the interview. In their case, the application took place in the mid of preparation, thus with a minimum of 1-1.5 month invested in practice.
Hope this helps,