BitMagicC++Library
Functions | Variables
sample11.cpp File Reference
#include <iostream>
#include <random>
#include "bm.h"
#include "bmalgo.h"
#include "bmtimer.h"
Include dependency graph for sample11.cpp:

Go to the source code of this file.

Functions

std::mt19937 gen (rand_dev())
 
std::uniform_int_distribution rand_dis (1, vector_max)
 
void generate_bvector (bm::bvector<> &bv)
 generate pseudo-random bit-vector, mix of blocks More...
 
unsigned pre_heat (const bm::bvector<> &bv)
 "pre-heat" CPU to minimize dynamic overclocking effects More...
 
void bv_count_test (const bm::bvector<> &bv)
 simple population count for the whole vector More...
 
void bv_count_range (const bm::bvector<> &bv)
 count_range() test More...
 
void bv_count_range_acc (const bm::bvector<> &bv)
 count_range() test using pre-calculated blocks bit count More...
 
void bv_count_to_acc (const bm::bvector<> &bv)
 count_to() test using pre-calculated blocks bit count More...
 
void bv_count_to_range_acc (const bm::bvector<> &bv)
 count_range implemented via two count_to() calls using pre-calculated running count More...
 
void bv_count_and (const bm::bvector<> &bv)
 count_range implemented via bm::count_and More...
 
void bv_counted_enumerator (const bm::bvector<> &bv)
 count_to implemented via bm::bvector<>::counted_enumerator More...
 
int main (void)
 

Variables

bm::chrono_taker::duration_map_type timing_map
 
const unsigned benchmark_count = 10000
 
unsigned vector_max = 400000000
 
std::random_device rand_dev
 

Function Documentation

◆ bv_count_and()

void bv_count_and ( const bm::bvector<> &  bv)

count_range implemented via bm::count_and

this method can be used, when we need co compute multiple ranges in one call

Examples:
sample11.cpp.

Definition at line 226 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().

◆ bv_count_range()

void bv_count_range ( const bm::bvector<> &  bv)

count_range() test

Examples:
sample11.cpp.

Definition at line 122 of file sample11.cpp.

References benchmark_count, bm::bvector< Alloc >::count_range(), gen(), rand_dis(), and timing_map.

Referenced by main().

◆ bv_count_range_acc()

void bv_count_range_acc ( const bm::bvector<> &  bv)

count_range() test using pre-calculated blocks bit count

Examples:
sample11.cpp.

Definition at line 142 of file sample11.cpp.

References benchmark_count, bm::bvector< Alloc >::count_blocks(), bm::bvector< Alloc >::count_range(), gen(), rand_dis(), bm::set_total_blocks, and timing_map.

Referenced by main().

◆ bv_count_test()

void bv_count_test ( const bm::bvector<> &  bv)

simple population count for the whole vector

Examples:
sample11.cpp.

Definition at line 105 of file sample11.cpp.

References benchmark_count, bm::bvector< Alloc >::count(), and timing_map.

Referenced by main().

◆ bv_count_to_acc()

void bv_count_to_acc ( const bm::bvector<> &  bv)

count_to() test using pre-calculated blocks bit count

Examples:
sample11.cpp.

Definition at line 170 of file sample11.cpp.

References benchmark_count, bm::bvector< Alloc >::count_to(), gen(), rand_dis(), bm::bvector< Alloc >::running_count_blocks(), and timing_map.

Referenced by main().

◆ bv_count_to_range_acc()

void bv_count_to_range_acc ( const bm::bvector<> &  bv)

count_range implemented via two count_to() calls using pre-calculated running count

Examples:
sample11.cpp.

Definition at line 194 of file sample11.cpp.

References benchmark_count, bm::bvector< Alloc >::count_to(), gen(), rand_dis(), bm::bvector< Alloc >::running_count_blocks(), and timing_map.

Referenced by main().

◆ bv_counted_enumerator()

void bv_counted_enumerator ( const bm::bvector<> &  bv)

count_to implemented via bm::bvector<>::counted_enumerator

Counted enumerator is an iterator automata, which counts the running population count along the iteration sequence

Examples:
sample11.cpp.

Definition at line 255 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().

◆ gen()

std::mt19937 gen ( rand_dev()  )

◆ generate_bvector()

void generate_bvector ( bm::bvector<> &  bv)

◆ main()

int main ( void  )

◆ pre_heat()

unsigned pre_heat ( const bm::bvector<> &  bv)

"pre-heat" CPU to minimize dynamic overclocking effects

Examples:
sample11.cpp.

Definition at line 89 of file sample11.cpp.

References benchmark_count, and bm::bvector< Alloc >::count().

Referenced by main().

◆ rand_dis()

std::uniform_int_distribution rand_dis ( ,
vector_max   
)

Variable Documentation

◆ benchmark_count

const unsigned benchmark_count = 10000

◆ rand_dev

std::random_device rand_dev
Examples:
sample11.cpp.

Definition at line 44 of file sample11.cpp.

◆ timing_map

bm::chrono_taker::duration_map_type timing_map

◆ vector_max

unsigned vector_max = 400000000
Examples:
sample11.cpp.

Definition at line 42 of file sample11.cpp.

Referenced by generate_bvector().