Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dynamic_bitset<> find_next() improvements #1

Closed
wants to merge 3 commits into from

Conversation

alyst
Copy link
Contributor

@alyst alyst commented Jan 12, 2014

This pull request should provide some performance improvements to dynamic_bitset<>::find_next() by simplifying bit operations and using built-in instructions for finding the lowest bit. It also provides dynamic_bitset<> hash implementation (so it could be used by unordered_map/set<>).

There were corresponding tickets in boost.org trac for years already:

But there were no response from the maintainers. Also my post to boost.org mailing list had seen no feedback.
So this is my attempt to get some feedback via the new Github-based boost infrastructure.

Alexey Stukalov added 3 commits January 12, 2014 21:17
Instead of masking all bits in the current block that were already
visited and then finding the lowest remaining bit, it shifts the current
block directly to the first unvisited bit and identifies the lowest
set bit.
It requires fewer operations that the original implementation and should
be faster.

See https://svn.boost.org/trac/boost/ticket/5159.
__builtin_ctz[l][l]() is built-in gcc/icc/clang operation to find
the lowest bit, _BitScanForward[64]() is MSVC builtin one.
It replaces the default arithmetic-based lowest_bit() implementation
for the types that support this operation.

The patch should improve the efficiency of dynamic_bitset<>
traversing. See https://svn.boost.org/trac/boost/ticket/5158.

Multiplatform support uses bits&pieces from
boost/multiprecision/detail/bitscan.hpp.
@ahmedcharles
Copy link
Contributor

I need to do more work for testing to get these patches submitted.

@IanS4t1qbit
Copy link

IanS4t1qbit commented Jun 13, 2018

Has dynamic_bitset<> hash actually been implemented? I am using a std::unordered_map<dynamic_bitset<>, double> but the compiler does not find a hash function.

@BrannonKing
Copy link

Why is this closed? I needed the hash functionality here at least.

@jeking3
Copy link
Contributor

jeking3 commented Jun 6, 2019

Looks like the ball got dropped on this one. Instead of re-opening it, will (re)submit one PR per commit. The lowest_bit optimization probably needs more preprocessor conditionals to support other platforms, similar to recent changes made for popcnt acceleration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants