[FFmpeg-devel] [PATCH] Optimization of original IFF codec
Thu Apr 22 22:05:39 CEST 2010
M?ns Rullg?rd a ?crit :
>> But this time I'm not only replacing * with << and / with >> , but also
>> were able to remove a multiplication inside a loop replacing with an
> Did you check if these actually change the compiled code? I bet most
> of them don't.
Unless it's not -O0 it probably won't change anything (the mul by add
replacement will probably only optimized, if at all, at -O2 ...
Also it's pretty meaningless just to compare the compiled code with just
my compiler version, since ffmpeg should work with GCC 2 onwards...
But as said, we should be consequent on this, having here a * 2 and
there a << 1 looks somewhat weird...it probably will also some small
amounts of compile time, since the optimizer hasn't to do stuff like
this anymore by itself.
Also running less code in the compiler's optimizer code also reduces the
change by triggering bugs in this code.
Of course, this is for each single a minimal save, but if there are over
1000th's of such changes of this style by hand, there might be saved one
or other second of compile time.
It also forces people reading our code to think more bit-wise than
decimal wise, which is pretty useful by the stuff here we're doing,
since we're throwing a lot of &, |, ^, <<, >> around here, right? ;)
It also makes absolutely clear that we're dealing with integer
arithmetic...a / 2 can either mean divide a float by int, or an int by int.
So consider this also as some kind of educational patch :D
:-) Basty/CDGS (-:
More information about the ffmpeg-devel