@@ -372,8 +372,17 @@ class HomogRibbonFilter {
372
372
373
373
void AddAll (const vector<uint64_t > keys, const size_t start, const size_t end) {
374
374
size_t add_count = end - start;
375
- double factor = sizeof (CoeffType) == 16 ? 1.045 : 1.095 ;
376
- size_t num_slots = (size_t )(add_count * factor);
375
+ double overhead = kMilliBitsPerKey < 4000 ? 0.033 : 0.046 ;
376
+ if (sizeof (CoeffType) == 8 ) {
377
+ overhead *= 2 ;
378
+ } else if (sizeof (CoeffType) == 4 ) {
379
+ overhead *= 4 ;
380
+ } else if (sizeof (CoeffType) == 2 ) {
381
+ overhead *= 8 ;
382
+ } else {
383
+ assert (sizeof (CoeffType) == 16 );
384
+ }
385
+ size_t num_slots = (size_t )(add_count * (1.0 + overhead));
377
386
num_slots = InterleavedSoln::RoundUpNumSlots (num_slots);
378
387
Banding b (num_slots);
379
388
(void )b.AddRange (keys.begin () + start, keys.begin () + end);
@@ -1226,9 +1235,33 @@ Statistics FilterBenchmark(
1226
1235
#endif
1227
1236
const auto start_time = NowNanos ();
1228
1237
found_count = 0 ;
1238
+ #ifndef NEW_CONTAINS_BENCHMARK
1229
1239
for (const auto v : to_lookup_mixed) {
1230
1240
found_count += FilterAPI<Table>::Contain (v, &filter);
1231
1241
}
1242
+ #else
1243
+ auto lower = to_lookup_mixed.begin ();
1244
+ auto upper = to_lookup_mixed.end ();
1245
+ while (lower != upper) {
1246
+ while (FilterAPI<Table>::Contain (*(lower++), &filter)) {
1247
+ ++found_count;
1248
+ if (lower == upper) {
1249
+ goto lower_neq_upper;
1250
+ }
1251
+ }
1252
+ if (lower == upper) {
1253
+ goto lower_neq_upper;
1254
+ }
1255
+ while (FilterAPI<Table>::Contain (*(--upper), &filter)) {
1256
+ ++found_count;
1257
+ if (lower == upper) {
1258
+ goto lower_neq_upper;
1259
+ }
1260
+ }
1261
+ }
1262
+ lower_neq_upper:
1263
+ #endif
1264
+
1232
1265
const auto lookup_time = NowNanos () - start_time;
1233
1266
#ifdef WITH_LINUX_EVENTS
1234
1267
unified.end (results);
@@ -1369,10 +1402,18 @@ int main(int argc, char * argv[]) {
1369
1402
{63 , " SuccCountBlockBloomRank10" },
1370
1403
1371
1404
{70 , " Xor8-singleheader" },
1372
- {80 , " Morton" },
1373
-
1374
- {86 , " HomogRibbon64" },
1375
- {87 , " HomogRibbon128" },
1405
+ {71 , " Xor3 (NBitArray)" },
1406
+ {72 , " Xor7 (NBitArray)" },
1407
+ {79 , " Morton" },
1408
+
1409
+ {80 , " HomogRibbon16_3" },
1410
+ {81 , " HomogRibbon32_3" },
1411
+ {82 , " HomogRibbon64_3" },
1412
+ {83 , " HomogRibbon128_3" },
1413
+ {84 , " HomogRibbon16_7" },
1414
+ {85 , " HomogRibbon32_7" },
1415
+ {86 , " HomogRibbon64_7" },
1416
+ {87 , " HomogRibbon128_7" },
1376
1417
1377
1418
{90 , " XorFuse8" },
1378
1419
@@ -1850,8 +1891,22 @@ int main(int argc, char * argv[]) {
1850
1891
add_count, to_add, distinct_add, to_lookup, distinct_lookup, intersectionsize, hasduplicates, mixed_sets, seed, true );
1851
1892
cout << setw (NAME_WIDTH) << names[a] << cf << endl;
1852
1893
}
1894
+ a = 71 ;
1895
+ if (algorithmId == a || (algos.find (a) != algos.end ())) {
1896
+ auto cf = FilterBenchmark<
1897
+ XorFilter2<uint64_t , uint8_t , NBitArray<uint8_t , 3 >, SimpleMixSplit>>(
1898
+ add_count, to_add, distinct_add, to_lookup, distinct_lookup, intersectionsize, hasduplicates, mixed_sets, seed, true );
1899
+ cout << setw (NAME_WIDTH) << names[a] << cf << endl;
1900
+ }
1901
+ a = 72 ;
1902
+ if (algorithmId == a || (algos.find (a) != algos.end ())) {
1903
+ auto cf = FilterBenchmark<
1904
+ XorFilter2<uint64_t , uint8_t , NBitArray<uint8_t , 7 >, SimpleMixSplit>>(
1905
+ add_count, to_add, distinct_add, to_lookup, distinct_lookup, intersectionsize, hasduplicates, mixed_sets, seed, true );
1906
+ cout << setw (NAME_WIDTH) << names[a] << cf << endl;
1907
+ }
1853
1908
1854
- a = 80 ;
1909
+ a = 79 ;
1855
1910
if (algorithmId == a || (algos.find (a) != algos.end ())) {
1856
1911
auto cf = FilterBenchmark<
1857
1912
MortonFilter>(
@@ -1860,18 +1915,59 @@ int main(int argc, char * argv[]) {
1860
1915
}
1861
1916
1862
1917
// Homogeneous Ribbon
1918
+ a = 80 ;
1919
+ if (algorithmId == a || algorithmId < 0 || (algos.find (a) != algos.end ())) {
1920
+ auto cf = FilterBenchmark<
1921
+ HomogRibbonFilter<uint16_t , /* millibits per key*/ 3800 >>(
1922
+ add_count, to_add, distinct_add, to_lookup, distinct_lookup, intersectionsize, hasduplicates, mixed_sets, seed, true );
1923
+ cout << setw (NAME_WIDTH) << names[a] << cf << endl;
1924
+ }
1925
+ a = 81 ;
1926
+ if (algorithmId == a || algorithmId < 0 || (algos.find (a) != algos.end ())) {
1927
+ auto cf = FilterBenchmark<
1928
+ HomogRibbonFilter<uint32_t , /* millibits per key*/ 3400 >>(
1929
+ add_count, to_add, distinct_add, to_lookup, distinct_lookup, intersectionsize, hasduplicates, mixed_sets, seed, true );
1930
+ cout << setw (NAME_WIDTH) << names[a] << cf << endl;
1931
+ }
1932
+ a = 82 ;
1933
+ if (algorithmId == a || algorithmId < 0 || (algos.find (a) != algos.end ())) {
1934
+ auto cf = FilterBenchmark<
1935
+ HomogRibbonFilter<uint64_t , /* millibits per key*/ 3200 >>(
1936
+ add_count, to_add, distinct_add, to_lookup, distinct_lookup, intersectionsize, hasduplicates, mixed_sets, seed, true );
1937
+ cout << setw (NAME_WIDTH) << names[a] << cf << endl;
1938
+ }
1939
+ a = 83 ;
1940
+ if (algorithmId == a || algorithmId < 0 || (algos.find (a) != algos.end ())) {
1941
+ auto cf = FilterBenchmark<
1942
+ HomogRibbonFilter<Unsigned128, /* millibits per key*/ 3100 >>(
1943
+ add_count, to_add, distinct_add, to_lookup, distinct_lookup, intersectionsize, hasduplicates, mixed_sets, seed, true );
1944
+ cout << setw (NAME_WIDTH) << names[a] << cf << endl;
1945
+ }
1946
+ a = 84 ;
1947
+ if (algorithmId == a || algorithmId < 0 || (algos.find (a) != algos.end ())) {
1948
+ auto cf = FilterBenchmark<
1949
+ HomogRibbonFilter<uint16_t , /* millibits per key*/ 9800 >>(
1950
+ add_count, to_add, distinct_add, to_lookup, distinct_lookup, intersectionsize, hasduplicates, mixed_sets, seed, true );
1951
+ cout << setw (NAME_WIDTH) << names[a] << cf << endl;
1952
+ }
1953
+ a = 85 ;
1954
+ if (algorithmId == a || algorithmId < 0 || (algos.find (a) != algos.end ())) {
1955
+ auto cf = FilterBenchmark<
1956
+ HomogRibbonFilter<uint32_t , /* millibits per key*/ 8400 >>(
1957
+ add_count, to_add, distinct_add, to_lookup, distinct_lookup, intersectionsize, hasduplicates, mixed_sets, seed, true );
1958
+ cout << setw (NAME_WIDTH) << names[a] << cf << endl;
1959
+ }
1863
1960
a = 86 ;
1864
1961
if (algorithmId == a || algorithmId < 0 || (algos.find (a) != algos.end ())) {
1865
1962
auto cf = FilterBenchmark<
1866
- HomogRibbonFilter<uint64_t , /* millibits per key*/ 8912 >>(
1963
+ HomogRibbonFilter<uint64_t , /* millibits per key*/ 7700 >>(
1867
1964
add_count, to_add, distinct_add, to_lookup, distinct_lookup, intersectionsize, hasduplicates, mixed_sets, seed, true );
1868
1965
cout << setw (NAME_WIDTH) << names[a] << cf << endl;
1869
1966
}
1870
-
1871
1967
a = 87 ;
1872
1968
if (algorithmId == a || algorithmId < 0 || (algos.find (a) != algos.end ())) {
1873
1969
auto cf = FilterBenchmark<
1874
- HomogRibbonFilter<Unsigned128, /* millibits per key*/ 8456 >>(
1970
+ HomogRibbonFilter<Unsigned128, /* millibits per key*/ 7350 >>(
1875
1971
add_count, to_add, distinct_add, to_lookup, distinct_lookup, intersectionsize, hasduplicates, mixed_sets, seed, true );
1876
1972
cout << setw (NAME_WIDTH) << names[a] << cf << endl;
1877
1973
}
0 commit comments