[MDEV-23865] malloc function attribute will improve performance Created: 2020-10-01 Updated: 2023-07-12 Resolved: 2023-07-12 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Server |
| Fix Version/s: | 11.1.2, 11.2.1 |
| Type: | Task | Priority: | Minor |
| Reporter: | Georgy Kirichenko | Assignee: | Daniel Black |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | beginner-friendly | ||
| Description |
|
Description: 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: |
| Comments |
| Comment by Sergei Golubchik [ 2020-10-03 ] |
|
would you want to submit a patch or create a pull request for this? |
| Comment by Georgy Kirichenko [ 2020-10-07 ] |
|
Hi Sergei! Please give me some time to contribute, I am preparing a patch right now. |
| Comment by Zhao Junwang [ 2020-10-22 ] |
|
I'v tested this by adding something below, using sysbench oltp_point_select, see no improvement. ``` |
| Comment by Georgy Kirichenko [ 2020-10-23 ] |
|
As I discovered the effect may depend on optimization options (I got performance impact using -O3 but not with -O2) I am working right now on finding circumstances allowing gcc to improve performance if the attribute was given. |