[MDEV-7942] InnoDB: abuse of UNIV_LIKELY()/UNIV_UNLIKELY() Created: 2015-04-09 Updated: 2015-05-11 Resolved: 2015-05-11 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - InnoDB, Storage Engine - XtraDB |
| Affects Version/s: | 10.1 |
| Fix Version/s: | 10.1.5 |
| Type: | Bug | Priority: | Minor |
| Reporter: | Sergey Vojtovich | Assignee: | Jan Lindström (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Epic Link: | Performance: micro optimizations |
| Description |
|
UNIV_LIKELY()/UNIV_UNLIKELY() hints are supposed to improve branch prediction. They're defined in InnoDB as following:
In other words they're expected to work only if cond evaluates to TRUE or FALSE, However there're a few conditions that may evaluate to different values, e.g.:
Either fix condition or fix UNIV_LIKELY() to evaluate condition to bool (see likely() in my_global.h). |
| Comments |
| Comment by Jan Lindström (Inactive) [ 2015-05-11 ] |
|
commit 58e8db2eb398a812e2894d28db4173a4f67fea06 UNIV_LIKELY()/UNIV_UNLIKELY() hints are supposed to improve branch prediction. However there're a few conditions that may evaluate to different values, e.g.: page/page0zip.cc: if (UNIV_LIKELY(c_stream->avail_in)) { Fixed these conditions so that they evaluate TRUE/FALSE. |