Opened 12 years ago
Last modified 3 years ago
#5158 new Feature Requests
speed up lowest_bit() for gcc 4.x compatibles
| Reported by: | Owned by: | James E. King, III | |
|---|---|---|---|
| Milestone: | Component: | dynamic_bitset | |
| Version: | Severity: | Optimization | |
| Keywords: | Cc: |
Description
The patch provides specialization of lowest_bit() template that utilizes builtin_ctz[l][l]() function, available for gcc 4.x-compatible compilers, instead of calculation-intensive path that makes use of integer_log2().
Since lowest_bit() is used in dynamic_bitset::find_first()/find_next(), the patch leads to significant speed up for bitset traversal.
The patch was tested on gcc 4.5.2 x86_64 and icc 11.1 x86_64.
Currently, the patch provides no checks, if builting_ctz is available for current toolset. I can try to add this, given the overall positive feedback.
Attachments (1)
Change History (5)
by , 12 years ago
| Attachment: | lowest_bit.patch added |
|---|
comment:1 by , 9 years ago
| Owner: | changed from to |
|---|---|
| Status: | new → assigned |
Proposed fix in: https://github.com/boostorg/dynamic_bitset/pull/1
comment:2 by , 9 years ago
| Component: | integer → dynamic_bitset |
|---|---|
| Milestone: | To Be Determined → Boost 1.56.0 |
comment:3 by , 9 years ago
| Type: | Patches → Feature Requests |
|---|
comment:4 by , 3 years ago
| Milestone: | Boost 1.56.0 |
|---|---|
| Owner: | changed from to |
| Status: | assigned → new |
| Summary: | [pending] speed up lowest_bit() for gcc 4.x compatibles → speed up lowest_bit() for gcc 4.x compatibles |
| Version: | Boost Development Trunk |

lowest_bit() patch against the trunk