[MDEV-19787] Speedup Table_map_iterator, via compiler intrinsics Created: 2019-06-17  Updated: 2019-07-09  Resolved: 2019-07-09

Status: Closed
Project: MariaDB Server
Component/s: Server
Fix Version/s: 10.5.0

Type: Task Priority: Minor
Reporter: Vladislav Vaintroub Assignee: Vladislav Vaintroub
Resolution: Fixed Votes: 0
Labels: performance


 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


Generated at Thu Feb 08 08:54:21 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.