63 for (j = 0; j < 65535*8; i += 10, j++)
70 for (j = 0; j < 65535; i += 120, j++)
72 unsigned len = rand() % 64;
85 bm::bvector<>::statistics st;
88 std::cout <<
"Bit-vector statistics: GAP (compressed blocks)=" << st.gap_blocks
89 <<
", BIT (uncompressed blocks)=" << st.bit_blocks
90 << std::endl << std::endl;
125 std::cout <<
"Count test finished." << cnt <<
"\r";
146 std::cout <<
"Count range test finished." << cnt <<
"\r";
172 std::cout <<
"Count range with blocks test finished." << cnt <<
"\r";
196 std::cout <<
"Count to with blocks test finished." << cnt <<
"\r";
229 std::cout <<
"Count range via count_to test finished." << cnt <<
"\r";
258 std::cout <<
"count AND finished." << cnt <<
"\r";
277 bm::bvector<>::counted_enumerator en = bv.
first();
278 for (; en.valid(); ++en)
286 std::cout <<
"counted_enumerator finished." << cnt <<
"\r";
301 std::cout << s <<
"\r";
360 catch(std::exception& ex)
362 std::cerr << ex.what() << std::endl;
Compressed bit-vector bvector<> container, set algebraic methods, traversal iterators.
#define BM_DECLARE_TEMP_BLOCK(x)
Algorithms for bvector<> (main include)
Timing utilities for benchmarking (internal)
size_type count() const BMNOEXCEPT
population cout (count of ON bits)
bvector< Alloc > & set(size_type n, bool val=true)
Sets bit n if val is true, clears bit n if val is false.
void optimize(bm::word_t *temp_block=0, optmode opt_mode=opt_compress, statistics *stat=0)
Optimize memory bitvector's memory allocation.
enumerator first() const
Returns enumerator pointing on the first non-zero bit.
size_type count_range(size_type left, size_type right, const rs_index_type &rs_idx) const BMNOEXCEPT
Returns count of 1 bits in the given range [left..right] Uses rank-select index to accelerate the sea...
bvector< Alloc > & set_range(size_type left, size_type right, bool value=true)
Sets all bits in the specified closed interval [left,right] Interval must be inside the bvector's siz...
void clear(const size_type *ids, size_type ids_size, bm::sort_order so=bm::BM_UNKNOWN)
clear list of bits in this bitset
size_type count_to(size_type n, const rs_index_type &rs_idx) const BMNOEXCEPT
Returns count of 1 bits (population) in [0..right] range.
void build_rs_index(rs_index_type *rs_idx, bvector< Alloc > *bv_blocks=0) const
compute running total of all blocks in bit vector (rank-select index)
void calc_stat(struct bm::bvector< Alloc >::statistics *st) const BMNOEXCEPT
Calculates bitvector statistics.
Utility class to collect performance measurements and statistics.
std::map< std::string, statistics > duration_map_type
test name to duration map
static void print_duration_map(const duration_map_type &dmap, format fmt=ct_time)
@ BM_GAP
GAP compression is ON.
BV::size_type count_and(const BV &bv1, const BV &bv2) BMNOEXCEPT
Computes bitcount of AND operation of two bitsets.
const unsigned benchmark_count
static void bv_count_range(const bm::bvector<> &bv)
count_range() test
static bm::bvector ::size_type pre_heat(const bm::bvector<> &bv)
"pre-heat" CPU to minimize dynamic overclocking effects
static void bv_count_to_range_acc(const bm::bvector<> &bv)
count_range implemented via two count_to() calls using pre-calculated rank-select index
std::random_device rand_dev
static void bv_count_range_acc(const bm::bvector<> &bv)
count_range() test using pre-calculated blocks bit count
bm::chrono_taker::duration_map_type timing_map
std::uniform_int_distribution rand_dis(1, int(vector_max))
std::mt19937 gen(rand_dev())
static void bv_count_test(const bm::bvector<> &bv)
simple population count for the whole vector
static void generate_bvector(bm::bvector<> &bv)
generate pseudo-random bit-vector, mix of blocks
static void bv_count_and(const bm::bvector<> &bv)
count_range implemented via bm::count_and
static void bv_count_to_acc(const bm::bvector<> &bv)
count_to() test using pre-calculated rank-select index
static void bv_counted_enumerator(const bm::bvector<> &bv)
count_to implemented via bm::bvector<>::counted_enumerator