Details
-
Task
-
Status: Closed (View Workflow)
-
Minor
-
Resolution: Fixed
Description
Description:
GCC supports a malloc function attribute (https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#Common-Function-Attribu...) which tells that a function allocates a new unused memory chunk which allows compiler to do some optimizations.
According to my investigation such attribute, applied on MySQL allocation functions like my_malloc, me_realloc, my_memdump, my_str(n)dup and some others, improves performance (sysbench used).
Unfortunately the attribute is supported by GCC only (clang has similar attribute - allocator - but it is not used for optimization purposes), however MY_ATTRIBUTE macro able to handle it.
So I would like to suggest to mark all memory allocation function with the attribute.
How to repeat:
Annotate all allocation function with MY_ATTRIBUTE((malloc)) and compare sysbench results