Size, within reason, should not matter since the bikes are adapted, even designed for the rider. For instance, when they wind tunnel test their fairings, the final testing is done with the actual rider on the bike. The VR46 Yamaha fairing, may well differ in small ways to the MV12 fairing. Same with seat, seat position, tank, tank position, etc. Another example that I can think off is the "dent" in the top of the tank where the rider rests his chin is different for each rider.
It is true that the taller riders struggle more to adapt to the bikes as the bikes are very small and the distance between foot pegs and seat can only be adapted to a certain extend. They should however have an advantage when it comes to leverage as suggested by Sonny already. Their issue is usually added weight which does have an impact on tyre life and on performance. I am not sure that the performance impact is big enough to be measurable, but tyre life is definitely a problem.
All of the above is true for MGP, 1000cc era and even the current Moto 2 class. In Moto 3 size, weight and length, do play a much bigger role due to the minuscule size of the bikes and their lack of torque.
Dani struggled cos of his size in motogp....
Dani only really struggled after the introduction of the Michelin tyres. The disadvantage he had during the previous era was much smaller.