Skip to content

Commit 3b47af1

Browse files
committed
Misc updates
1 parent 1a368de commit 3b47af1

File tree

1 file changed

+106
-10
lines changed

1 file changed

+106
-10
lines changed

benchmarks/bulk-insert-and-query.cc

Lines changed: 106 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -372,8 +372,17 @@ class HomogRibbonFilter {
372372

373373
void AddAll(const vector<uint64_t> keys, const size_t start, const size_t end) {
374374
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));
377386
num_slots = InterleavedSoln::RoundUpNumSlots(num_slots);
378387
Banding b(num_slots);
379388
(void)b.AddRange(keys.begin() + start, keys.begin() + end);
@@ -1226,9 +1235,33 @@ Statistics FilterBenchmark(
12261235
#endif
12271236
const auto start_time = NowNanos();
12281237
found_count = 0;
1238+
#ifndef NEW_CONTAINS_BENCHMARK
12291239
for (const auto v : to_lookup_mixed) {
12301240
found_count += FilterAPI<Table>::Contain(v, &filter);
12311241
}
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+
12321265
const auto lookup_time = NowNanos() - start_time;
12331266
#ifdef WITH_LINUX_EVENTS
12341267
unified.end(results);
@@ -1369,10 +1402,18 @@ int main(int argc, char * argv[]) {
13691402
{63, "SuccCountBlockBloomRank10"},
13701403

13711404
{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"},
13761417

13771418
{90, "XorFuse8"},
13781419

@@ -1850,8 +1891,22 @@ int main(int argc, char * argv[]) {
18501891
add_count, to_add, distinct_add, to_lookup, distinct_lookup, intersectionsize, hasduplicates, mixed_sets, seed, true);
18511892
cout << setw(NAME_WIDTH) << names[a] << cf << endl;
18521893
}
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+
}
18531908

1854-
a = 80;
1909+
a = 79;
18551910
if (algorithmId == a || (algos.find(a) != algos.end())) {
18561911
auto cf = FilterBenchmark<
18571912
MortonFilter>(
@@ -1860,18 +1915,59 @@ int main(int argc, char * argv[]) {
18601915
}
18611916

18621917
// 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+
}
18631960
a = 86;
18641961
if (algorithmId == a || algorithmId < 0 || (algos.find(a) != algos.end())) {
18651962
auto cf = FilterBenchmark<
1866-
HomogRibbonFilter<uint64_t, /*millibits per key*/ 8912>>(
1963+
HomogRibbonFilter<uint64_t, /*millibits per key*/ 7700>>(
18671964
add_count, to_add, distinct_add, to_lookup, distinct_lookup, intersectionsize, hasduplicates, mixed_sets, seed, true);
18681965
cout << setw(NAME_WIDTH) << names[a] << cf << endl;
18691966
}
1870-
18711967
a = 87;
18721968
if (algorithmId == a || algorithmId < 0 || (algos.find(a) != algos.end())) {
18731969
auto cf = FilterBenchmark<
1874-
HomogRibbonFilter<Unsigned128, /*millibits per key*/ 8456>>(
1970+
HomogRibbonFilter<Unsigned128, /*millibits per key*/ 7350>>(
18751971
add_count, to_add, distinct_add, to_lookup, distinct_lookup, intersectionsize, hasduplicates, mixed_sets, seed, true);
18761972
cout << setw(NAME_WIDTH) << names[a] << cf << endl;
18771973
}

0 commit comments

Comments
 (0)