Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
https://godbolt.org/z/Ech577Tad
It is a smart solution, because it uses the standard library, but one of the slowest ones.
It creates an unnecessary temporary object with significant overhead.
Overal solution is 1.5 times slower than a table lookup algorithm and 2.5 times slower than parallel bits counting algorithm.
I would not recommend it as a best practices.
On my Core i7-4770K best performance is obviously using popcnt instruction, but this one is the next best. The most recommended solution with bitset has the worst performance so far.
CPU clocks per item calculated:
popcnt 2.7
parallel bits counting 6.2
lookup table 11.0
std::bitset 16.3