Opened 12 years ago

Last modified 3 years ago

#5158 new Feature Requests

speed up lowest_bit() for gcc 4.x compatibles

Reported by: astukalov@… 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)

lowest_bit.patch (667 bytes ) - added by astukalov@… 12 years ago.
lowest_bit() patch against the trunk

Download all attachments as: .zip

Change History (5)

by astukalov@…, 12 years ago

Attachment: lowest_bit.patch added

lowest_bit() patch against the trunk

comment:1 by acharles, 9 years ago

Owner: changed from Daryle Walker to acharles
Status: newassigned

comment:2 by acharles, 9 years ago

Component: integerdynamic_bitset
Milestone: To Be DeterminedBoost 1.56.0

comment:3 by acharles, 9 years ago

Type: PatchesFeature Requests

comment:4 by James E. King, III, 3 years ago

Milestone: Boost 1.56.0
Owner: changed from acharles to James E. King, III
Status: assignednew
Summary: [pending] speed up lowest_bit() for gcc 4.x compatiblesspeed up lowest_bit() for gcc 4.x compatibles
Version: Boost Development Trunk
Note: See TracTickets for help on using tickets.