Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-19787

Speedup Table_map_iterator, via compiler intrinsics

    XMLWordPrintable

    Details

      Description

      Table_map_iterator in sql_bitmap.h iterates over all bits set in a ulonglong variable.
      Current implementation shows that there was an attempt to make it optimized, with prebuilt small offset table, and this gives in my tests about 30% improvement over naïve implementation.

      But as I found during my test, using compiler intrinsics such as _builtin_ctzll(GCC,Clang) or _BitScanForward64(MSVC) can speed it up further by 200-300% over the current implementation.

      intrinsics map to bsf instructions on Intel processors

        Attachments

          Activity

            People

            Assignee:
            wlad Vladislav Vaintroub
            Reporter:
            wlad Vladislav Vaintroub
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: