BitMagic-C++
|
Example: bvector<> bit-counting techniques analysis. More...
#include <iostream>
#include <random>
#include <memory>
#include "bm.h"
#include "bmalgo.h"
#include "bmtimer.h"
#include "bmundef.h"
Go to the source code of this file.
Functions | |
std::mt19937 | gen (rand_dev()) |
More... | |
std::uniform_int_distribution | rand_dis (1, int(vector_max)) |
More... | |
static void | generate_bvector (bm::bvector<> &bv) |
generate pseudo-random bit-vector, mix of blocks More... | |
static bm::bvector ::size_type | pre_heat (const bm::bvector<> &bv) |
"pre-heat" CPU to minimize dynamic overclocking effects More... | |
static void | bv_count_test (const bm::bvector<> &bv) |
simple population count for the whole vector More... | |
static void | bv_count_range (const bm::bvector<> &bv) |
count_range() test More... | |
static void | bv_count_range_acc (const bm::bvector<> &bv) |
count_range() test using pre-calculated blocks bit count More... | |
static void | bv_count_to_acc (const bm::bvector<> &bv) |
count_to() test using pre-calculated rank-select index More... | |
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 More... | |
static void | bv_count_and (const bm::bvector<> &bv) |
count_range implemented via bm::count_and More... | |
static void | bv_counted_enumerator (const bm::bvector<> &bv) |
count_to implemented via bm::bvector<>::counted_enumerator More... | |
int | main (void) |
More... | |
Variables | |
bm::chrono_taker ::duration_map_type | timing_map |
More... | |
const unsigned | benchmark_count = 10000 |
More... | |
unsigned | vector_max = 400000000 |
More... | |
std::random_device | rand_dev |
More... | |
Example: bvector<> bit-counting techniques analysis.
Definition in file sample11.cpp.
|
static |
count_range implemented via bm::count_and
this method can be used, when we need co compute multiple ranges in one call
Definition at line 239 of file sample11.cpp.
References benchmark_count, bm::BM_GAP, bm::bvector< Alloc >::clear(), bm::count_and(), gen(), rand_dis(), bm::bvector< Alloc >::set_range(), and timing_map.
Referenced by main().
|
static |
count_range() test
Definition at line 133 of file sample11.cpp.
References benchmark_count, bm::bvector< Alloc >::count_range(), gen(), rand_dis(), and timing_map.
Referenced by main().
|
static |
count_range() test using pre-calculated blocks bit count
Definition at line 154 of file sample11.cpp.
References benchmark_count, bm::bvector< Alloc >::build_rs_index(), bm::bvector< Alloc >::count_range(), gen(), rand_dis(), and timing_map.
Referenced by main().
|
static |
simple population count for the whole vector
Definition at line 115 of file sample11.cpp.
References benchmark_count, bm::bvector< Alloc >::count(), and timing_map.
Referenced by main().
|
static |
count_to() test using pre-calculated rank-select index
Definition at line 180 of file sample11.cpp.
References benchmark_count, bm::bvector< Alloc >::build_rs_index(), bm::bvector< Alloc >::count_to(), gen(), rand_dis(), and timing_map.
Referenced by main().
|
static |
count_range implemented via two count_to() calls using pre-calculated rank-select index
Definition at line 206 of file sample11.cpp.
References benchmark_count, bm::bvector< Alloc >::build_rs_index(), bm::bvector< Alloc >::count_to(), gen(), rand_dis(), and timing_map.
Referenced by main().
|
static |
count_to implemented via bm::bvector<>::counted_enumerator
Counted enumerator is an iterator automata, which counts the running population count along the iteration sequence
Definition at line 269 of file sample11.cpp.
References benchmark_count, bm::bvector< Alloc >::counted_enumerator::count(), bm::bvector< Alloc >::first(), gen(), rand_dis(), timing_map, and bm::bvector< Alloc >::iterator_base::valid().
Referenced by main().
std::mt19937 gen | ( | rand_dev() | ) |
Referenced by bv_count_and(), bv_count_range(), bv_count_range_acc(), bv_count_to_acc(), bv_count_to_range_acc(), bv_counted_enumerator(), and pick_benchmark_set().
|
static |
generate pseudo-random bit-vector, mix of blocks
Definition at line 59 of file sample11.cpp.
References bm::bv_statistics::bit_blocks, BM_DECLARE_TEMP_BLOCK, bm::bvector< Alloc >::calc_stat(), bm::bv_statistics::gap_blocks, bm::bvector< Alloc >::optimize(), bm::bvector< Alloc >::set(), bm::bvector< Alloc >::set_range(), and vector_max.
Referenced by main().
int main | ( | void | ) |
pre-heat CPU to minimize dynamic overclocking
Definition at line 294 of file sample11.cpp.
References bv_count_and(), bv_count_range(), bv_count_range_acc(), bv_count_test(), bv_count_to_acc(), bv_count_to_range_acc(), bv_counted_enumerator(), generate_bvector(), pre_heat(), bm::chrono_taker< TOut >::print_duration_map(), and timing_map.
|
static |
"pre-heat" CPU to minimize dynamic overclocking effects
Definition at line 98 of file sample11.cpp.
References benchmark_count, and bm::bvector< Alloc >::count().
Referenced by main().
std::uniform_int_distribution rand_dis | ( | 1 | , |
int(vector_max) | |||
) |
Referenced by bv_count_and(), bv_count_range(), bv_count_range_acc(), bv_count_to_acc(), bv_count_to_range_acc(), bv_counted_enumerator(), and pick_benchmark_set().