I also think it depends on the degree of 'giftedness'.
There's conflicting literature on this, with different people definiting 'exceptionally gifted' in different ways, but even if you just look at something like IQ scores, the range of abilities within the top 2% of the population is as wide as the range that spans the middle 96%, because of the 'humped' shape of the distribution curve.
Selective secondary schools - private or state grammar - will [as a general rule] be good at teaching the 'moderately gifted', and possibly slightly better than non-selective schools because such children will have a larger peer group in such schools who can possibly be grouped for relevant subjects e.g. maths. Weighed against that, of curse, is the social disadvantages of being educated with a limited range of people, and also the problems that may arise from being gifted in one area but not across the board.
When it comes to the 'exceptionally gifted' - those '1 in 10,000' or '1 in 100,000' children - then it is not so clear which schools are best. Some schools - superselective grammars and one or two of the very top academic independents - may have particular experience in dealing with such children. On the other hand, what such children most often need is flexibility - e.g. access to higher age groups for particular subjects, as well as nurture - and there is no guarantee that a 'normal' private school would be any better for this than a state school.
I happen to know a child in the 'exceptionally gifted' group, who is privately educated. Although initially flexible - e.g. allowing access to the maths curriculum for higher years of secondary while in the junior school - once access has been needed from outwith the school (university-level work while in KS3) it has been more difficult and parents have had to arrange it outside the school,system entirely.