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
I'v tested this by adding something below, using sysbench oltp_point_select, see no improvement.
Then I used objdump see the dissasembly code, same as before.
Any idea?
Zhao Junwang
added a comment - - edited I'v tested this by adding something below, using sysbench oltp_point_select, see no improvement.
Then I used objdump see the dissasembly code, same as before.
Any idea?
```
_ attribute _((malloc))
void *my_malloc(PSI_memory_key key, size_t size, myf my_flags)
```
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.
Georgy Kirichenko
added a comment - 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.
People
Daniel Black
Georgy Kirichenko
Votes:
0Vote for this issue
Watchers:
5Start watching this issue
Dates
Created:
Updated:
Resolved:
Git Integration
Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.
{"report":{"fcp":867.2999999523163,"ttfb":207.40000009536743,"pageVisibility":"visible","entityId":92282,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":1,"journeyId":"87215838-3139-4cde-ace8-94b35a591349","navigationType":0,"readyForUser":930.2999999523163,"redirectCount":0,"resourceLoadedEnd":572.7000000476837,"resourceLoadedStart":220.09999990463257,"resourceTiming":[{"duration":14.300000190734863,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":220.09999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":220.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":234.40000009536743,"responseStart":0,"secureConnectionStart":0},{"duration":14.700000047683716,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2bu7/820016/12ta74/8679b4946efa1a0bb029a3a22206fb5d/_/download/contextbatch/css/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true","startTime":220.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":220.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":235.20000004768372,"responseStart":0,"secureConnectionStart":0},{"duration":215.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/fbf975c0cce4b1abf04784eeae9ba1f4-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":220.59999990463257,"connectEnd":220.59999990463257,"connectStart":220.59999990463257,"domainLookupEnd":220.59999990463257,"domainLookupStart":220.59999990463257,"fetchStart":220.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":237.70000004768372,"responseEnd":436.09999990463257,"responseStart":283,"secureConnectionStart":220.59999990463257},{"duration":351.60000014305115,"initiatorType":"script","name":"https://jira.mariadb.org/s/099b33461394b8015fc36c0a4b96e19f-CDN/lu2bu7/820016/12ta74/8679b4946efa1a0bb029a3a22206fb5d/_/download/contextbatch/js/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true","startTime":221.09999990463257,"connectEnd":221.09999990463257,"connectStart":221.09999990463257,"domainLookupEnd":221.09999990463257,"domainLookupStart":221.09999990463257,"fetchStart":221.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":238,"responseEnd":572.7000000476837,"responseStart":320.90000009536743,"secureConnectionStart":221.09999990463257},{"duration":66,"initiatorType":"script","name":"https://jira.mariadb.org/s/94c15bff32baef80f4096a08aceae8bc-CDN/lu2bu7/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":221.20000004768372,"connectEnd":221.20000004768372,"connectStart":221.20000004768372,"domainLookupEnd":221.20000004768372,"domainLookupStart":221.20000004768372,"fetchStart":221.20000004768372,"redirectEnd":0,"redirectStart":0,"requestStart":238.79999995231628,"responseEnd":287.2000000476837,"responseStart":284.09999990463257,"secureConnectionStart":221.20000004768372},{"duration":69.70000004768372,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":221.29999995231628,"connectEnd":221.29999995231628,"connectStart":221.29999995231628,"domainLookupEnd":221.29999995231628,"domainLookupStart":221.29999995231628,"fetchStart":221.29999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":239.40000009536743,"responseEnd":291,"responseStart":286.09999990463257,"secureConnectionStart":221.29999995231628},{"duration":70.09999990463257,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":221.40000009536743,"connectEnd":221.40000009536743,"connectStart":221.40000009536743,"domainLookupEnd":221.40000009536743,"domainLookupStart":221.40000009536743,"fetchStart":221.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":241.09999990463257,"responseEnd":291.5,"responseStart":288.09999990463257,"secureConnectionStart":221.40000009536743},{"duration":20.59999990463257,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2bu7/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":221.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":221.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":242.09999990463257,"responseStart":0,"secureConnectionStart":0},{"duration":70.10000014305115,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":221.59999990463257,"connectEnd":221.59999990463257,"connectStart":221.59999990463257,"domainLookupEnd":221.59999990463257,"domainLookupStart":221.59999990463257,"fetchStart":221.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":243.09999990463257,"responseEnd":291.7000000476837,"responseStart":288.7999999523163,"secureConnectionStart":221.59999990463257},{"duration":20.299999952316284,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2bu7/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/css/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.css?jira.create.linked.issue=true","startTime":221.79999995231628,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":221.79999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":242.09999990463257,"responseStart":0,"secureConnectionStart":0},{"duration":70.29999995231628,"initiatorType":"script","name":"https://jira.mariadb.org/s/3339d87fa2538a859872f2df449bf8d0-CDN/lu2bu7/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/js/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.js?jira.create.linked.issue=true&locale=en","startTime":221.90000009536743,"connectEnd":221.90000009536743,"connectStart":221.90000009536743,"domainLookupEnd":221.90000009536743,"domainLookupStart":221.90000009536743,"fetchStart":221.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":246.29999995231628,"responseEnd":292.2000000476837,"responseStart":290,"secureConnectionStart":221.90000009536743},{"duration":314.59999990463257,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":223.20000004768372,"connectEnd":223.20000004768372,"connectStart":223.20000004768372,"domainLookupEnd":223.20000004768372,"domainLookupStart":223.20000004768372,"fetchStart":223.20000004768372,"redirectEnd":0,"redirectStart":0,"requestStart":266.7999999523163,"responseEnd":537.7999999523163,"responseStart":533.0999999046326,"secureConnectionStart":223.20000004768372},{"duration":314,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":223.5,"connectEnd":223.5,"connectStart":223.5,"domainLookupEnd":223.5,"domainLookupStart":223.5,"fetchStart":223.5,"redirectEnd":0,"redirectStart":0,"requestStart":267.40000009536743,"responseEnd":537.5,"responseStart":532.4000000953674,"secureConnectionStart":223.5},{"duration":62.799999952316284,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":586.7000000476837,"connectEnd":586.7000000476837,"connectStart":586.7000000476837,"domainLookupEnd":586.7000000476837,"domainLookupStart":586.7000000476837,"fetchStart":586.7000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":604.4000000953674,"responseEnd":649.5,"responseStart":647.7999999523163,"secureConnectionStart":586.7000000476837},{"duration":194.70000004768372,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":822.7999999523163,"connectEnd":822.7999999523163,"connectStart":822.7999999523163,"domainLookupEnd":822.7999999523163,"domainLookupStart":822.7999999523163,"fetchStart":822.7999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":985.9000000953674,"responseEnd":1017.5,"responseStart":1016.9000000953674,"secureConnectionStart":822.7999999523163},{"duration":126.90000009536743,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":860.5999999046326,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":860.5999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":987.5,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":51,"responseStart":208,"responseEnd":223,"domLoading":215,"domInteractive":979,"domContentLoadedEventStart":979,"domContentLoadedEventEnd":1025,"domComplete":1650,"loadEventStart":1650,"loadEventEnd":1651,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":958.0999999046326},{"name":"bigPipe.sidebar-id.end","time":958.9000000953674},{"name":"bigPipe.activity-panel-pipe-id.start","time":959.0999999046326},{"name":"bigPipe.activity-panel-pipe-id.end","time":960.5},{"name":"activityTabFullyLoaded","time":1042.2000000476837}],"measures":[],"correlationId":"e68d8de4a46473","effectiveType":"4g","downlink":9.6,"rtt":0,"serverDuration":85,"dbReadsTimeInMs":13,"dbConnsTimeInMs":22,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
would you want to submit a patch or create a pull request for this?