While benchmarking purge, I found that ut_allocator allocations are unnecessarily slow.
About half of the allocation time is spent on looking up perfschema memory keys for corresponding to the source files (so called "auto" keys), the other half is spend on the actual malloc(). Performance schema was not even enabled in the test.
What the lookup function ut_new_get_key_by_file() currently does, it takes the value of _FILE _ passed down by the caller, strips the path, strips the extension, and looks up the result in the STL map
First, the string operations (strcmp/strchr/strrchr) are expensive. Second, if performance schema is OFF , this is just cycles now well spent.
A better solution would be
a) do not do any lookup if perfschema is OFF
b) if perfschema is ON, lookup integers, not the C style string. constexpr trickery can be applied to generate some kind of string hash, e.g djb2, for the basename_noext(_FILE _) already at compile time, and we use this for lookup, rather than strings.
Vladislav Vaintroub
made changes -
2020-06-09 10:51
Field
Original Value
New Value
Status
Open
[ 1
]
Confirmed
[ 10101
]
Vladislav Vaintroub
made changes -
2020-06-09 10:52
Assignee
Vladislav Vaintroub
[ wlad
]
Eugene Kosov
[ kevg
]
Status
Confirmed
[ 10101
]
In Review
[ 10002
]
Eugene Kosov (Inactive)
made changes -
2020-06-10 09:42
Assignee
Eugene Kosov
[ kevg
]
Vladislav Vaintroub
[ wlad
]
Status
In Review
[ 10002
]
Stalled
[ 10000
]
Vladislav Vaintroub
made changes -
2020-07-28 07:20
Fix Version/s
10.5.3
[ 24263
]
Fix Version/s
10.5
[ 23123
]
Resolution
Fixed
[ 1
]
Status
Stalled
[ 10000
]
Closed
[ 6
]
Sergei Golubchik
made changes -
2021-12-06 21:51
Workflow
MariaDB v3
[ 109745
]
MariaDB v4
[ 157931
]
{"report":{"fcp":765.1999999284744,"ttfb":194.5,"pageVisibility":"visible","entityId":88037,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":1,"journeyId":"352a6356-42c7-470c-9d21-fd1381b0329c","navigationType":0,"readyForUser":842.0999999046326,"redirectCount":0,"resourceLoadedEnd":841.5,"resourceLoadedStart":199.19999992847443,"resourceTiming":[{"duration":6.5,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":199.19999992847443,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":199.19999992847443,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":205.69999992847443,"responseStart":0,"secureConnectionStart":0},{"duration":7.699999928474426,"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":199.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":199.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":207.19999992847443,"responseStart":0,"secureConnectionStart":0},{"duration":65.90000009536743,"initiatorType":"script","name":"https://jira.mariadb.org/s/fbf975c0cce4b1abf04784eeae9ba1f4-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":199.59999990463257,"connectEnd":199.59999990463257,"connectStart":199.59999990463257,"domainLookupEnd":199.59999990463257,"domainLookupStart":199.59999990463257,"fetchStart":199.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":199.59999990463257,"responseEnd":265.5,"responseStart":265.5,"secureConnectionStart":199.59999990463257},{"duration":148.79999995231628,"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":199.79999995231628,"connectEnd":199.79999995231628,"connectStart":199.79999995231628,"domainLookupEnd":199.79999995231628,"domainLookupStart":199.79999995231628,"fetchStart":199.79999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":199.79999995231628,"responseEnd":348.59999990463257,"responseStart":348.59999990463257,"secureConnectionStart":199.79999995231628},{"duration":152.19999992847443,"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":200,"connectEnd":200,"connectStart":200,"domainLookupEnd":200,"domainLookupStart":200,"fetchStart":200,"redirectEnd":0,"redirectStart":0,"requestStart":200,"responseEnd":352.1999999284744,"responseStart":352.1999999284744,"secureConnectionStart":200},{"duration":152.5,"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":200.19999992847443,"connectEnd":200.19999992847443,"connectStart":200.19999992847443,"domainLookupEnd":200.19999992847443,"domainLookupStart":200.19999992847443,"fetchStart":200.19999992847443,"redirectEnd":0,"redirectStart":0,"requestStart":200.19999992847443,"responseEnd":352.6999999284744,"responseStart":352.6999999284744,"secureConnectionStart":200.19999992847443},{"duration":152.60000002384186,"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":200.29999995231628,"connectEnd":200.29999995231628,"connectStart":200.29999995231628,"domainLookupEnd":200.29999995231628,"domainLookupStart":200.29999995231628,"fetchStart":200.29999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":200.29999995231628,"responseEnd":352.89999997615814,"responseStart":352.89999997615814,"secureConnectionStart":200.29999995231628},{"duration":205.89999997615814,"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":200.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":200.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":406.39999997615814,"responseStart":0,"secureConnectionStart":0},{"duration":152.80000007152557,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":200.59999990463257,"connectEnd":200.59999990463257,"connectStart":200.59999990463257,"domainLookupEnd":200.59999990463257,"domainLookupStart":200.59999990463257,"fetchStart":200.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":200.59999990463257,"responseEnd":353.39999997615814,"responseStart":353.39999997615814,"secureConnectionStart":200.59999990463257},{"duration":205.79999995231628,"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":200.79999995231628,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":200.79999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":406.59999990463257,"responseStart":0,"secureConnectionStart":0},{"duration":153.09999990463257,"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":201,"connectEnd":201,"connectStart":201,"domainLookupEnd":201,"domainLookupStart":201,"fetchStart":201,"redirectEnd":0,"redirectStart":0,"requestStart":201,"responseEnd":354.09999990463257,"responseStart":354.09999990463257,"secureConnectionStart":201},{"duration":416.6999999284744,"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":206.89999997615814,"connectEnd":206.89999997615814,"connectStart":206.89999997615814,"domainLookupEnd":206.89999997615814,"domainLookupStart":206.89999997615814,"fetchStart":206.89999997615814,"redirectEnd":0,"redirectStart":0,"requestStart":206.89999997615814,"responseEnd":623.5999999046326,"responseStart":623.5999999046326,"secureConnectionStart":206.89999997615814},{"duration":510.5,"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":207.79999995231628,"connectEnd":207.79999995231628,"connectStart":207.79999995231628,"domainLookupEnd":207.79999995231628,"domainLookupStart":207.79999995231628,"fetchStart":207.79999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":207.79999995231628,"responseEnd":718.2999999523163,"responseStart":718.2999999523163,"secureConnectionStart":207.79999995231628},{"duration":206.30000007152557,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":417.59999990463257,"connectEnd":417.59999990463257,"connectStart":417.59999990463257,"domainLookupEnd":417.59999990463257,"domainLookupStart":417.59999990463257,"fetchStart":417.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":417.59999990463257,"responseEnd":623.8999999761581,"responseStart":623.8999999761581,"secureConnectionStart":417.59999990463257},{"duration":169.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/e65b778d185daf5aee24936755b43da6/_/download/contextbatch/js/browser-metrics-plugin.contrib,-_super,-project.issue.navigator,-jira.view.issue,-atl.general/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true","startTime":672,"connectEnd":672,"connectStart":672,"domainLookupEnd":672,"domainLookupStart":672,"fetchStart":672,"redirectEnd":0,"redirectStart":0,"requestStart":672,"responseEnd":841.5,"responseStart":841.5,"secureConnectionStart":672}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":20,"responseStart":195,"responseEnd":208,"domLoading":198,"domInteractive":907,"domContentLoadedEventStart":907,"domContentLoadedEventEnd":954,"domComplete":1158,"loadEventStart":1158,"loadEventEnd":1159,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":878.5999999046326},{"name":"bigPipe.sidebar-id.end","time":879.2999999523163},{"name":"bigPipe.activity-panel-pipe-id.start","time":879.5},{"name":"bigPipe.activity-panel-pipe-id.end","time":882.1999999284744},{"name":"activityTabFullyLoaded","time":974.5999999046326}],"measures":[],"correlationId":"35d5adc26c5122","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":119,"dbReadsTimeInMs":23,"dbConnsTimeInMs":32,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
fixed long ago