UNIV_LIKELY()/UNIV_UNLIKELY() hints are supposed to improve branch prediction. They're defined in InnoDB as following:
/* Tell the compiler that 'expr' probably evaluates to 'constant'. */
|
# define UNIV_EXPECT(expr,constant) __builtin_expect(expr, constant)
|
/* Tell the compiler that cond is likely to hold */
|
#define UNIV_LIKELY(cond) UNIV_EXPECT(cond, TRUE)
|
/* Tell the compiler that cond is unlikely to hold */
|
#define UNIV_UNLIKELY(cond) UNIV_EXPECT(cond, FALSE)
|
In other words they're expected to work only if cond evaluates to TRUE or FALSE,
see https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html.
However there're a few conditions that may evaluate to different values, e.g.:
page/page0zip.cc: if (UNIV_LIKELY(c_stream->avail_in)) {
|
page/page0zip.cc: if (UNIV_LIKELY(c_stream->avail_in)) {
|
dict/dict0mem.cc: if (UNIV_LIKELY(i) && UNIV_UNLIKELY(!table->col_names)) {
|
Either fix condition or fix UNIV_LIKELY() to evaluate condition to bool (see likely() in my_global.h).
Note: we'll gain little to nothing in terms of performance out of this. But at least we'll have correct use of these compiler hints.
{"report":{"fcp":1087.2999992370605,"ttfb":238,"pageVisibility":"visible","entityId":50797,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"c9239ca4-ec33-4c8e-b154-38112556bf31","navigationType":0,"readyForUser":1169.5999994277954,"redirectCount":0,"resourceLoadedEnd":1316.3999996185303,"resourceLoadedStart":243.5999994277954,"resourceTiming":[{"duration":321.9000005722046,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":243.5999994277954,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":243.5999994277954,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":565.5,"responseStart":0,"secureConnectionStart":0},{"duration":321.8999996185303,"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":243.89999961853027,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":243.89999961853027,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":565.7999992370605,"responseStart":0,"secureConnectionStart":0},{"duration":332.69999980926514,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":244.0999994277954,"connectEnd":244.0999994277954,"connectStart":244.0999994277954,"domainLookupEnd":244.0999994277954,"domainLookupStart":244.0999994277954,"fetchStart":244.0999994277954,"redirectEnd":0,"redirectStart":0,"requestStart":244.0999994277954,"responseEnd":576.7999992370605,"responseStart":576.7999992370605,"secureConnectionStart":244.0999994277954},{"duration":396.20000076293945,"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":244.29999923706055,"connectEnd":244.29999923706055,"connectStart":244.29999923706055,"domainLookupEnd":244.29999923706055,"domainLookupStart":244.29999923706055,"fetchStart":244.29999923706055,"redirectEnd":0,"redirectStart":0,"requestStart":244.29999923706055,"responseEnd":640.5,"responseStart":640.5,"secureConnectionStart":244.29999923706055},{"duration":400,"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":244.5,"connectEnd":244.5,"connectStart":244.5,"domainLookupEnd":244.5,"domainLookupStart":244.5,"fetchStart":244.5,"redirectEnd":0,"redirectStart":0,"requestStart":244.5,"responseEnd":644.5,"responseStart":644.5,"secureConnectionStart":244.5},{"duration":400.20000076293945,"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":244.79999923706055,"connectEnd":244.79999923706055,"connectStart":244.79999923706055,"domainLookupEnd":244.79999923706055,"domainLookupStart":244.79999923706055,"fetchStart":244.79999923706055,"redirectEnd":0,"redirectStart":0,"requestStart":244.79999923706055,"responseEnd":645,"responseStart":645,"secureConnectionStart":244.79999923706055},{"duration":400.29999923706055,"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":245,"connectEnd":245,"connectStart":245,"domainLookupEnd":245,"domainLookupStart":245,"fetchStart":245,"redirectEnd":0,"redirectStart":0,"requestStart":245,"responseEnd":645.2999992370605,"responseStart":645.2999992370605,"secureConnectionStart":245},{"duration":477.5999994277954,"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":245.19999980926514,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":245.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":722.7999992370605,"responseStart":0,"secureConnectionStart":0},{"duration":400.5,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":245.39999961853027,"connectEnd":245.39999961853027,"connectStart":245.39999961853027,"domainLookupEnd":245.39999961853027,"domainLookupStart":245.39999961853027,"fetchStart":245.39999961853027,"redirectEnd":0,"redirectStart":0,"requestStart":245.39999961853027,"responseEnd":645.8999996185303,"responseStart":645.8999996185303,"secureConnectionStart":245.39999961853027},{"duration":477.30000019073486,"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":245.5999994277954,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":245.5999994277954,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":722.8999996185303,"responseStart":0,"secureConnectionStart":0},{"duration":400.80000019073486,"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":245.79999923706055,"connectEnd":245.79999923706055,"connectStart":245.79999923706055,"domainLookupEnd":245.79999923706055,"domainLookupStart":245.79999923706055,"fetchStart":245.79999923706055,"redirectEnd":0,"redirectStart":0,"requestStart":245.79999923706055,"responseEnd":646.5999994277954,"responseStart":646.5999994277954,"secureConnectionStart":245.79999923706055},{"duration":567.8000001907349,"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":246.5999994277954,"connectEnd":246.5999994277954,"connectStart":246.5999994277954,"domainLookupEnd":246.5999994277954,"domainLookupStart":246.5999994277954,"fetchStart":246.5999994277954,"redirectEnd":0,"redirectStart":0,"requestStart":246.5999994277954,"responseEnd":814.3999996185303,"responseStart":814.3999996185303,"secureConnectionStart":246.5999994277954},{"duration":1069.6999998092651,"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":246.69999980926514,"connectEnd":246.69999980926514,"connectStart":246.69999980926514,"domainLookupEnd":246.69999980926514,"domainLookupStart":246.69999980926514,"fetchStart":246.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":246.69999980926514,"responseEnd":1316.3999996185303,"responseStart":1316.3999996185303,"secureConnectionStart":246.69999980926514},{"duration":78.10000038146973,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":737.3999996185303,"connectEnd":737.3999996185303,"connectStart":737.3999996185303,"domainLookupEnd":737.3999996185303,"domainLookupStart":737.3999996185303,"fetchStart":737.3999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":737.3999996185303,"responseEnd":815.5,"responseStart":815.5,"secureConnectionStart":737.3999996185303},{"duration":361.9000005722046,"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":1006.0999994277954,"connectEnd":1006.0999994277954,"connectStart":1006.0999994277954,"domainLookupEnd":1006.0999994277954,"domainLookupStart":1006.0999994277954,"fetchStart":1006.0999994277954,"redirectEnd":0,"redirectStart":0,"requestStart":1006.0999994277954,"responseEnd":1368,"responseStart":1368,"secureConnectionStart":1006.0999994277954}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":82,"responseStart":238,"responseEnd":241,"domLoading":241,"domInteractive":1337,"domContentLoadedEventStart":1337,"domContentLoadedEventEnd":1377,"domComplete":2726,"loadEventStart":2726,"loadEventEnd":2728,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1318.2999992370605},{"name":"bigPipe.sidebar-id.end","time":1319.1999998092651},{"name":"bigPipe.activity-panel-pipe-id.start","time":1319.2999992370605},{"name":"bigPipe.activity-panel-pipe-id.end","time":1321.7999992370605},{"name":"activityTabFullyLoaded","time":1384.1999998092651}],"measures":[],"correlationId":"6dbc81ca16aea6","effectiveType":"4g","downlink":9.8,"rtt":0,"serverDuration":99,"dbReadsTimeInMs":12,"dbConnsTimeInMs":19,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}