@@ -291,6 +291,28 @@ struct FilterAPI<XorFilter<ItemType, FingerprintType>> {
291291 }
292292};
293293
294+
295+ template <size_t blocksize, int k, typename HashFamily>
296+ struct FilterAPI <SimpleBlockFilter<blocksize,k,HashFamily>> {
297+ using Table = SimpleBlockFilter<blocksize,k,HashFamily>;
298+ static Table ConstructFromAddCount (size_t add_count) {
299+ Table ans (ceil (add_count * 8.0 / CHAR_BIT));
300+ return ans;
301+ }
302+ static void Add (uint64_t key, Table* table) {
303+ table->Add (key);
304+ }
305+ static void AddAll (const vector<uint64_t > keys, const size_t start, const size_t end, Table* table) {
306+ throw std::runtime_error (" Unsupported" );
307+ }
308+
309+ CONTAIN_ATTRIBUTES
310+ static bool Contain (uint64_t key, const Table * table) {
311+ return table->Find (key);
312+ }
313+ };
314+
315+
294316template <typename ItemType, typename FingerprintType, typename HashFamily>
295317struct FilterAPI <XorFilter<ItemType, FingerprintType, HashFamily>> {
296318 using Table = XorFilter<ItemType, FingerprintType, HashFamily>;
@@ -678,43 +700,6 @@ void parse_comma_separated(char * c, std::set<int> & answer ) {
678700 }
679701}
680702
681- /*
682- #define MUL 1625L
683- #define MUL2 (MUL*MUL)
684- // (1<<64) / MUL
685- #define INVMUL 11351842506898185L
686- // (1<<64) / MUL2
687- #define INVMUL2 6985749235014L
688- int main() {
689- printf("start\n");
690- for (int a = 0; a < MUL; a++) {
691- for (int b = 0; b < MUL; b++) {
692- for (int c = 0; c < MUL; c++) {
693- uint32_t x = a * MUL2 + b * MUL + c;
694- int aa = (int) (((__uint128_t) x * (INVMUL2 + 1)) >> 64);
695- if (aa != a) {
696- printf("wrong a");
697- return -1;
698- }
699- int bb = (int) (((__uint128_t) x * (INVMUL + 1)) >> 64);
700- int rb = bb % MUL;
701- if (rb != b) {
702- printf("wrong b");
703- return -1;
704- }
705- int expected = (a + b + c) % MUL;
706- int got = (aa + bb + x) % MUL;
707- if (expected != got) {
708- printf("wrong modulo");
709- return -1;
710- }
711- }
712- }
713- }
714- printf("end\n");
715- return 0;
716- }
717- */
718703
719704int main (int argc, char * argv[]) {
720705#ifdef __aarch64__
@@ -726,7 +711,8 @@ int main(int argc, char * argv[]) {
726711 {14 ," GCS" }, {22 , " Xor10 (NBitArray)" }, {23 , " Xor14 (NBitArray)" },
727712 {25 , " Xor10" },{26 , " Xor10.666" }, {37 ," Bloom8 (addall)" },
728713 {38 ," Bloom12 (addall)" },
729- {40 ," BlockedBloom (addall)" }
714+ {40 ," BlockedBloom (addall)" },
715+ {70 ," SimpleBlockedBloom" }
730716 };
731717#elif defined( __AVX2__)
732718 std::map<int ,std::string> names = {{0 ," Xor8" },{1 ," Xor12" },
@@ -737,7 +723,8 @@ int main(int argc, char * argv[]) {
737723 {14 ," GCS" }, {15 ," CQF" }, {22 , " Xor10 (NBitArray)" }, {23 , " Xor14 (NBitArray)" },
738724 {25 , " Xor10" },{26 , " Xor10.666" }, {37 ," Bloom8 (addall)" },
739725 {38 ," Bloom12 (addall)" },{39 ," Bloom16 (addall)" },
740- {40 ," BlockedBloom (addall)" }, {63 ," BlockedBloom16" }, {64 ," BlockedBloom64" }
726+ {40 ," BlockedBloom (addall)" }, {63 ," BlockedBloom16" }, {64 ," BlockedBloom64" },
727+ {70 ," SimpleBlockedBloom" }
741728 };
742729#else
743730 std::map<int ,std::string> names = {{0 ," Xor8" },{1 ," Xor12" },
@@ -747,7 +734,8 @@ int main(int argc, char * argv[]) {
747734 {11 ," sort" }, {12 ," Xor+8" }, {13 ," Xor+16" },
748735 {14 ," GCS" }, {22 , " Xor10 (NBitArray)" }, {23 , " Xor14 (NBitArray)" },
749736 {25 , " Xor10" },{26 , " Xor10.666" }, {37 ," Bloom8 (addall)" },
750- {38 ," Bloom12 (addall)" },{39 ," Bloom16 (addall)" }
737+ {38 ," Bloom12 (addall)" },{39 ," Bloom16 (addall)" },
738+ {70 ," SimpleBlockedBloom" }
751739 };
752740#endif
753741
@@ -1091,6 +1079,13 @@ int main(int argc, char * argv[]) {
10911079 add_count, to_add, distinct_add, to_lookup, distinct_lookup, intersectionsize, hasduplicates, mixed_sets, seed, true );
10921080 cout << setw (NAME_WIDTH) << names[23 ] << cf << endl;
10931081 }
1082+ if (algorithmId == 70 || (algos.find (70 ) != algos.end ())) {
1083+ auto cf = FilterBenchmark<
1084+ SimpleBlockFilter<8 , 8 , SimpleMixSplit>>(
1085+ add_count, to_add, distinct_add, to_lookup, distinct_lookup, intersectionsize, hasduplicates, mixed_sets, seed, false );
1086+ cout << setw (NAME_WIDTH) << names[70 ] << cf << endl;
1087+ }
1088+
10941089
10951090 // this algo overflows and crashes
10961091 /* if (algorithmId == 24 || (algos.find(24) != algos.end())) {
0 commit comments