~akopytov/percona-server/5.5-perf-fixes

Viewing all changes in revision 446.

  • Committer: Alexey Kopytov
  • Date: 2013-02-15 11:07:07 UTC
  • Revision ID: akopytov@gmail.com-20130215110707-ghm5wm10j5tvwguc
Bug #1125248: Suboptimal srv_pass_corrupt_table checks 

The problem:

srv_pass_corrupt_table was checked in many places in the code,
sometimes on critical paths. In most cases the check looked like this:

 block = btr_block_get(space, zip_size, root_page_no, RW_X_LATCH,
         index, mtr);

 if (srv_pass_corrupt_table && !block) {
  return(0);
 }
 ut_a(block);

For the common (i.e. non-corrupted) case:

- it is more efficient to first check for the 'block' value, since it
  is already in a register, and then the value of
  srv_pass_corrupt_table does not have to be loaded no branch 

- many branch mispredictions visible in profiles due to missing
  compiler annotations

- if srv_pass_corrupt_table is enabled, but block is not zero, it's
  value is checked twice.

Fixed by addressing all of the above problems in all
srv_pass_corrupt_table check sites.

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: