Type:
Task
Priority:
Minor
Resolution:
Fixed
current_thd() is called many times while creating Items (in many cases 2 or more calls per item).
The problem is not only the number of calls to current_thd(), but also that when we create items we cause more calls, like calling sql_alloc() that calls current_thd and then uses this to call alloc_root() with the right argumetns.
By adding thd as an argument to all functions that creates Items, we can avoid most calls to current_thd(). We can also call alloc_root() directly instead of calling it trough sql_alloc().
Changes in the code as part of this task:
Add THD as an argument to all functions that creates an Item.
Replace 'new Item_xxx' with 'new (thd->memroot) Item_xxx
Add thd->memroot as an argument to push_back() and push_front() for lists.
Before adding this to 10.1 code base, we need to benchmark the result to see that this big change is really worth it.
includes
MDEV-8010
Avoid sql_alloc() in Items
Closed
{"report":{"fcp":989.7000000476837,"ttfb":207.60000014305115,"pageVisibility":"visible","entityId":35709,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"5cb2bc5e-e998-4f98-947e-379dd6a9ead4","navigationType":0,"readyForUser":1064,"redirectCount":0,"resourceLoadedEnd":1335.6000001430511,"resourceLoadedStart":236.70000004768372,"resourceTiming":[{"duration":253.20000004768372,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":236.70000004768372,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":236.70000004768372,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":489.90000009536743,"responseStart":0,"secureConnectionStart":0},{"duration":252,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2cib/820016/12ta74/2bf333562ca6724060a9d5f1535471f6/_/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":238.20000004768372,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":238.20000004768372,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":490.2000000476837,"responseStart":0,"secureConnectionStart":0},{"duration":262.2000000476837,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":238.5,"connectEnd":238.5,"connectStart":238.5,"domainLookupEnd":238.5,"domainLookupStart":238.5,"fetchStart":238.5,"redirectEnd":0,"redirectStart":0,"requestStart":238.5,"responseEnd":500.7000000476837,"responseStart":500.7000000476837,"secureConnectionStart":238.5},{"duration":304.7999999523163,"initiatorType":"script","name":"https://jira.mariadb.org/s/2d8175ec2fa4c816e8023260bd8c1786-CDN/lu2cib/820016/12ta74/2bf333562ca6724060a9d5f1535471f6/_/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":238.90000009536743,"connectEnd":238.90000009536743,"connectStart":238.90000009536743,"domainLookupEnd":238.90000009536743,"domainLookupStart":238.90000009536743,"fetchStart":238.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":238.90000009536743,"responseEnd":543.7000000476837,"responseStart":543.7000000476837,"secureConnectionStart":238.90000009536743},{"duration":312.40000009536743,"initiatorType":"script","name":"https://jira.mariadb.org/s/a9324d6758d385eb45c462685ad88f1d-CDN/lu2cib/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":239.20000004768372,"connectEnd":239.20000004768372,"connectStart":239.20000004768372,"domainLookupEnd":239.20000004768372,"domainLookupStart":239.20000004768372,"fetchStart":239.20000004768372,"redirectEnd":0,"redirectStart":0,"requestStart":239.20000004768372,"responseEnd":551.6000001430511,"responseStart":551.6000001430511,"secureConnectionStart":239.20000004768372},{"duration":312.59999990463257,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":239.40000009536743,"connectEnd":239.40000009536743,"connectStart":239.40000009536743,"domainLookupEnd":239.40000009536743,"domainLookupStart":239.40000009536743,"fetchStart":239.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":239.40000009536743,"responseEnd":552,"responseStart":552,"secureConnectionStart":239.40000009536743},{"duration":312.89999985694885,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":239.60000014305115,"connectEnd":239.60000014305115,"connectStart":239.60000014305115,"domainLookupEnd":239.60000014305115,"domainLookupStart":239.60000014305115,"fetchStart":239.60000014305115,"redirectEnd":0,"redirectStart":0,"requestStart":239.60000014305115,"responseEnd":552.5,"responseStart":552.4000000953674,"secureConnectionStart":239.60000014305115},{"duration":411.69999980926514,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2cib/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":239.80000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":239.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":651.5,"responseStart":0,"secureConnectionStart":0},{"duration":411.7000000476837,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2cib/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":240,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":240,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":651.7000000476837,"responseStart":0,"secureConnectionStart":0},{"duration":313,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":240,"connectEnd":240,"connectStart":240,"domainLookupEnd":240,"domainLookupStart":240,"fetchStart":240,"redirectEnd":0,"redirectStart":0,"requestStart":240,"responseEnd":553,"responseStart":553,"secureConnectionStart":240},{"duration":313.39999985694885,"initiatorType":"script","name":"https://jira.mariadb.org/s/5d5e8fe91fbc506585e83ea3b62ccc4b-CDN/lu2cib/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":240.30000019073486,"connectEnd":240.30000019073486,"connectStart":240.30000019073486,"domainLookupEnd":240.30000019073486,"domainLookupStart":240.30000019073486,"fetchStart":240.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":240.30000019073486,"responseEnd":553.7000000476837,"responseStart":553.7000000476837,"secureConnectionStart":240.30000019073486},{"duration":604.2000000476837,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":269.5,"connectEnd":269.5,"connectStart":269.5,"domainLookupEnd":269.5,"domainLookupStart":269.5,"fetchStart":269.5,"redirectEnd":0,"redirectStart":0,"requestStart":269.5,"responseEnd":873.7000000476837,"responseStart":873.7000000476837,"secureConnectionStart":269.5},{"duration":1045,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":273.60000014305115,"connectEnd":273.60000014305115,"connectStart":273.60000014305115,"domainLookupEnd":273.60000014305115,"domainLookupStart":273.60000014305115,"fetchStart":273.60000014305115,"redirectEnd":0,"redirectStart":0,"requestStart":273.60000014305115,"responseEnd":1318.6000001430511,"responseStart":1318.6000001430511,"secureConnectionStart":273.60000014305115},{"duration":208.5,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":681.7000000476837,"connectEnd":681.7000000476837,"connectStart":681.7000000476837,"domainLookupEnd":681.7000000476837,"domainLookupStart":681.7000000476837,"fetchStart":681.7000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":681.7000000476837,"responseEnd":890.2000000476837,"responseStart":890.2000000476837,"secureConnectionStart":681.7000000476837},{"duration":394.40000009536743,"initiatorType":"link","name":"https://jira.mariadb.org/s/d5715adaadd168a9002b108b2b039b50-CDN/lu2cib/820016/12ta74/be4b45e9cec53099498fa61c8b7acba4/_/download/contextbatch/css/jira.project.sidebar,-_super,-project.issue.navigator,-jira.general,-jira.browse.project,-jira.view.issue,-jira.global,-atl.general,-com.atlassian.jira.projects.sidebar.init/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true","startTime":937.4000000953674,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":937.4000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1331.8000001907349,"responseStart":0,"secureConnectionStart":0},{"duration":388.40000009536743,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/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":938.4000000953674,"connectEnd":938.4000000953674,"connectStart":938.4000000953674,"domainLookupEnd":938.4000000953674,"domainLookupStart":938.4000000953674,"fetchStart":938.4000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":938.4000000953674,"responseEnd":1326.8000001907349,"responseStart":1326.8000001907349,"secureConnectionStart":938.4000000953674},{"duration":396.7000000476837,"initiatorType":"script","name":"https://jira.mariadb.org/s/097ae97cb8fbec7d6ea4bbb1f26955b9-CDN/lu2cib/820016/12ta74/be4b45e9cec53099498fa61c8b7acba4/_/download/contextbatch/js/jira.project.sidebar,-_super,-project.issue.navigator,-jira.general,-jira.browse.project,-jira.view.issue,-jira.global,-atl.general,-com.atlassian.jira.projects.sidebar.init/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true","startTime":938.9000000953674,"connectEnd":938.9000000953674,"connectStart":938.9000000953674,"domainLookupEnd":938.9000000953674,"domainLookupStart":938.9000000953674,"fetchStart":938.9000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":938.9000000953674,"responseEnd":1335.6000001430511,"responseStart":1335.6000001430511,"secureConnectionStart":938.9000000953674}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":4,"responseStart":207,"responseEnd":275,"domLoading":218,"domInteractive":1357,"domContentLoadedEventStart":1357,"domContentLoadedEventEnd":1398,"domComplete":2266,"loadEventStart":2266,"loadEventEnd":2267,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1339.2000000476837},{"name":"bigPipe.sidebar-id.end","time":1340.3000001907349},{"name":"bigPipe.activity-panel-pipe-id.start","time":1340.5},{"name":"bigPipe.activity-panel-pipe-id.end","time":1341.3000001907349},{"name":"activityTabFullyLoaded","time":1410.9000000953674}],"measures":[],"correlationId":"102c9c3d829acf","effectiveType":"4g","downlink":9,"rtt":0,"serverDuration":99,"dbReadsTimeInMs":13,"dbConnsTimeInMs":21,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
Pushed into 10.1