[MPlayer-dev-eng] -Wall

J. Grant jg-lists at jguk.org
Sat Jun 5 04:00:49 CEST 2004


> No, you're the one who's out of touch. Poking at unnecessary spots in
> memory can have all kinds of unpredictable impacts on cache
> performance on modern computers. On ancient cisc machines you could
> have known for sure that an extra initialization would "only" waste at
> most 3 clocks or whatever, but nowadays it's impossible to predict the
> impact on all different cpus, and in fact it's stupid to try. If code
> isn't needed, DON'T ADD IT. That simple.

I do not dispute this will make an incredibly minor and likely
completely insignificant change to the pipeline and flow of instructions,
data cache write etc after compilation and optimisation of the flow by
the compiler back-end.

The other more suitable alternative is turning the warning off, as I
also said.  That means no other cases would be caught then though, as
gcc does not have code specific #pragma warning disable support, last
time I checked.

> Still, it might only make 0.05% difference or less, but if you go with
> the stupid attitude of not caring, you'll end up with 100 places where
> you did similarly bad things, and all the sudden you've lost 5%
> performance!

It would never affect 0.05%.  If you really cared about performance each
intensive loop would be also coded in optimised asm for each platform
with only the C optimal version used as a fall-back.

> Actually, I _did_ read the code. That's why I know it's
> performance-intensive and why I know the variable is not used
> uninitialized. You're the one who assumed it was wrong just from the
> compiler warning.

Your wrong; I never said anything of the sort. I stated in this case the
variable could be initalised to stop the compiler being confused and
issuing a warning.

Complete compiler warnings is essential, we only have to ignore them if
one particular one is just because the compiler cannot determine
control-flow will result in a particular flow.  More information is
better than the present _none_.

I clearly saw from the logic uvdxy will always be set if chroma is >0;
and it will also only be used if chroma is >0.  My main points are that
we should have warnings on and initalising the variable would make
so insignificantly small difference.  So would you support having -Wall
and then ignoring the few bits which we can both see are are not problems?

Cheers

JG




More information about the MPlayer-dev-eng mailing list