[FFmpeg-devel] [PATCH] Add "cold" attribute to init/uninit functions in libavcodec
Wed Mar 19 14:35:43 CET 2008
GCC 4.3.0 adds a new attributes called "cold":
"The cold attribute is used to inform the compiler that a function is
unlikely executed. The function is optimized for size rather than
speed and on many targets it is placed into special subsection of the
text section so all cold functions appears close together improving
code locality of non-cold parts of program. The paths leading to call
of cold functions within code are marked as unlikely by the branch
prediction mechanism. It is thus useful to mark functions used to
handle unlikely conditions, such as perror, as cold to improve
optimization of hot functions that do call marked functions in rare
"When profile feedback is available, via -fprofile-use, hot(sic)
functions are automatically detected and this attribute is ignored.
"The hot(ditto) attribute is not implemented in GCC versions earlier than 4.3."
As suggested by Michael, this attribute may be nice for init/uninit
like functions in libav*. The attached patch is a first step, applying
this attribute to all functions that are either assigned as init or
close functions of a AVCodec object, or called exclusively by such
functions. I'll deal with DSP stuff later.
Please take a look to make sure that I didn't add something wrong or miss any.
BTW: This time I'm sure it won't break builds (again).
Beauty is truth,
While truth is beauty.
PGP KeyID: E8555ED6
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
More information about the ffmpeg-devel