g++ 4.3, troubles with C++ indexing idioms

tbp tbptbp@gmail.com
Wed Jul 25 00:48:00 GMT 2007


On 7/24/07, Richard Guenther <richard.guenther@gmail.com> wrote:
> For performance small arrays should be the same as individual members
> (I can see the annoying fact that initialization is a headache - this has
> annoyed me as well).  For larger arrays (>4 members), aliasing will
> make a difference possibly, making the array variant slower.  Any union
> variant is expected to be slower for aliasing reasons (we do not do
> field-sensitive aliasing for unions).
Confirmed :)
And thanks for the clue about the threshold.

> In the end I would still recommend to go with array variants.
I guess wishful thinking, or heresy, got me asking for a sanctioned
address-this-as-an-array idiom.; now i'll go with the flow and use
those 2nd class citizens of C++ aka array, even if i'm a bit sceptical
about the performance equivalence (granted it isn't as obvious as it
used to be, i need to investigate some more).
But for sure it can't be as terrible as unions...



More information about the Gcc mailing list