@ -258,12 +258,12 @@ TEST_F(DynamicBloomTest, concurrent_with_perf) {
timer . Start ( ) ;
timer . Start ( ) ;
std : : function < void ( size_t ) > adder = [ & ] ( size_t t ) {
std : : function < void ( size_t ) > adder ( [ & ] ( size_t t ) {
for ( uint64_t i = 1 + t ; i < = num_keys ; i + = num_threads ) {
for ( uint64_t i = 1 + t ; i < = num_keys ; i + = num_threads ) {
std_bloom . AddConcurrently (
std_bloom . AddConcurrently (
Slice ( reinterpret_cast < const char * > ( & i ) , 8 ) ) ;
Slice ( reinterpret_cast < const char * > ( & i ) , 8 ) ) ;
}
}
} ;
} ) ;
for ( size_t t = 0 ; t < num_threads ; + + t ) {
for ( size_t t = 0 ; t < num_threads ; + + t ) {
threads . emplace_back ( adder , t ) ;
threads . emplace_back ( adder , t ) ;
}
}
@ -279,13 +279,13 @@ TEST_F(DynamicBloomTest, concurrent_with_perf) {
timer . Start ( ) ;
timer . Start ( ) ;
std : : function < void ( size_t ) > hitter = [ & ] ( size_t t ) {
std : : function < void ( size_t ) > hitter ( [ & ] ( size_t t ) {
for ( uint64_t i = 1 + t ; i < = num_keys ; i + = num_threads ) {
for ( uint64_t i = 1 + t ; i < = num_keys ; i + = num_threads ) {
bool f =
bool f =
std_bloom . MayContain ( Slice ( reinterpret_cast < const char * > ( & i ) , 8 ) ) ;
std_bloom . MayContain ( Slice ( reinterpret_cast < const char * > ( & i ) , 8 ) ) ;
ASSERT_TRUE ( f ) ;
ASSERT_TRUE ( f ) ;
}
}
} ;
} ) ;
for ( size_t t = 0 ; t < num_threads ; + + t ) {
for ( size_t t = 0 ; t < num_threads ; + + t ) {
threads . emplace_back ( hitter , t ) ;
threads . emplace_back ( hitter , t ) ;
}
}
@ -302,7 +302,7 @@ TEST_F(DynamicBloomTest, concurrent_with_perf) {
timer . Start ( ) ;
timer . Start ( ) ;
std : : atomic < uint32_t > false_positives ( 0 ) ;
std : : atomic < uint32_t > false_positives ( 0 ) ;
std : : function < void ( size_t ) > misser = [ & ] ( size_t t ) {
std : : function < void ( size_t ) > misser ( [ & ] ( size_t t ) {
for ( uint64_t i = num_keys + 1 + t ; i < = 2 * num_keys ;
for ( uint64_t i = num_keys + 1 + t ; i < = 2 * num_keys ;
i + = num_threads ) {
i + = num_threads ) {
bool f =
bool f =
@ -311,7 +311,7 @@ TEST_F(DynamicBloomTest, concurrent_with_perf) {
+ + false_positives ;
+ + false_positives ;
}
}
}
}
} ;
} ) ;
for ( size_t t = 0 ; t < num_threads ; + + t ) {
for ( size_t t = 0 ; t < num_threads ; + + t ) {
threads . emplace_back ( misser , t ) ;
threads . emplace_back ( misser , t ) ;
}
}