Skip to content

Commit a4c05a2

Browse files
committed
Presenting the Linux metrics more elegantly. Disabling one broken algo.
1 parent 8ee775b commit a4c05a2

File tree

1 file changed

+27
-13
lines changed

1 file changed

+27
-13
lines changed

benchmarks/bulk-insert-and-query.cc

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -509,9 +509,13 @@ Statistics FilterBenchmark(
509509

510510
#ifdef __linux__
511511
unified.end(results);
512-
printf("cycles: %10.zu (%10.3f per key) instructions: %10.zu (%10.3f per key, %10.3f per cycle) cache misses: %10.zu (%10.3f per key) branch misses: %10.zu (%10.3f per key)\n",
513-
(size_t)results[0], results[0]*1.0/add_count, (size_t)results[1], results[1]*1.0/add_count , results[1]*1.0/results[0], (size_t)results[2], results[2]*1.0/add_count,
514-
(size_t)results[3], results[3] * 1.0/add_count);
512+
printf("adds ");
513+
printf("cycles: %4.1f/key, instructions: (%4.1f/key, %4.1f/cycle) cache misses: %4.2f/key branch misses: %4.2f/key\n",
514+
results[0]*1.0/add_count,
515+
results[1]*1.0/add_count ,
516+
results[1]*1.0/results[0],
517+
results[2]*1.0/add_count,
518+
results[3] * 1.0/add_count);
515519
#else
516520
std::cout << "." << std::flush;
517521
#endif
@@ -539,9 +543,13 @@ Statistics FilterBenchmark(
539543
const auto lookup_time = NowNanos() - start_time;
540544
#ifdef __linux__
541545
unified.end(results);
542-
printf("cycles: %10.zu (%10.3f per key) instructions: %10.zu (%10.3f per key, %10.3f per cycle) cache misses: %10.zu (%10.3f per key) branch misses: %10.zu (%10.3f per key)\n",
543-
(size_t)results[0], results[0]*1.0/to_lookup_mixed.size(), (size_t)results[1], results[1]*1.0/to_lookup_mixed.size() , results[1]*1.0/results[0], (size_t)results[2], results[2]*1.0/to_lookup_mixed.size(),
544-
(size_t)results[3], results[3] * 1.0/to_lookup_mixed.size());
546+
printf("%3.2f%% ",found_probability);
547+
printf("cycles: %4.1f/key, instructions: (%4.1f/key, %4.1f/cycle) cache misses: %4.2f/key branch misses: %4.1f/key\n",
548+
results[0]*1.0/to_lookup_mixed.size(),
549+
results[1]*1.0/to_lookup_mixed.size(),
550+
results[1]*1.0/results[0],
551+
results[2]*1.0/to_lookup_mixed.size(),
552+
results[3] * 1.0/to_lookup_mixed.size());
545553
#else
546554
std::cout << "." << std::flush;
547555
#endif
@@ -653,19 +661,20 @@ int main(int argc, char * argv[]) {
653661
{8,"Bloom12" }, {9,"Bloom16"}, {10,"BlockedBloom"},
654662
{11,"sort"}, {12,"Xor+8"}, {13,"Xor+16"},
655663
{14,"GCS"}, {15,"CQF"}, {22, "Xor10 (NBitArray)"}, {23, "Xor14 (NBitArray)"},
656-
{24, "Xor10.x"}, {25, "Xor10"},{26, "Xor10.666"}, {37,"Bloom8 (addall)"},
664+
{25, "Xor10"},{26, "Xor10.666"}, {37,"Bloom8 (addall)"},
657665
{38,"Bloom12 (addall)"},{39,"Bloom16 (addall)"},
658666
{40,"BlockedBloom (addall)"}
659667
};
660668

661669
if (argc < 2) {
662670
cout << "Usage: " << argv[0] << " <numberOfEntries> [<algorithmId> [<seed>]]" << endl;
663671
cout << " numberOfEntries: number of keys, we recommend at least 100000000" << endl;
664-
cout << " algorithmId: -1 for all (default), or 0..n to only run this algorithm" << endl;
672+
cout << " algorithmId: -1 for all default algos, or 0..n to only run this algorithm" << endl;
665673
cout << " algorithmId: can also be a comma-separated list of non-negative integers" << endl;
666674
for(auto i : names) {
667675
cout << " "<< i.first << " : " << i.second << endl;
668676
}
677+
cout << " algorithmId: can also be set to the string 'all' if you want to run them all, including some that are excluded by default" << endl;
669678
cout << " seed: seed for the PRNG; -1 for random seed (default)" << endl;
670679
return 1;
671680
}
@@ -676,14 +685,19 @@ int main(int argc, char * argv[]) {
676685
cerr << "Invalid number: " << argv[1];
677686
return 2;
678687
}
679-
int algorithmId = -1;
688+
int algorithmId = -1; // -1 is just the default
680689
std::set<int> algos;
681690
if (argc > 2) {
682-
if(strstr(argv[2],",") != NULL) {
691+
if(strcmp(argv[2],"all") == 0) {
692+
for(auto i : names) {// we add all the named algos.
693+
algos.insert(i.first);
694+
}
695+
} else if(strstr(argv[2],",") != NULL) {
683696
// we have a list of algos
684697
algorithmId = 9999999; // disabling
685698
parse_comma_separated(argv[2], algos);
686699
} else {
700+
// we select just one
687701
stringstream input_string_2(argv[2]);
688702
input_string_2 >> algorithmId;
689703
if (input_string_2.fail()) {
@@ -966,13 +980,13 @@ int main(int argc, char * argv[]) {
966980
cout << setw(NAME_WIDTH) << names[23] << cf << endl;
967981
}
968982

969-
970-
if (algorithmId == 24 || (algos.find(24) != algos.end())) {
983+
// this algo overflows and crashes
984+
/*if (algorithmId == 24 || (algos.find(24) != algos.end())) {
971985
auto cf = FilterBenchmark<
972986
XorFilter2<uint64_t, uint32_t, UInt10Array, SimpleMixSplit>>(
973987
add_count, to_add, distinct_add, to_lookup, distinct_lookup, intersectionsize, hasduplicates, mixed_sets, seed, true);
974988
cout << setw(NAME_WIDTH) << names[24] << cf << endl;
975-
}
989+
}*/
976990

977991
if (algorithmId == 25 || (algos.find(25) != algos.end())) {
978992
auto cf = FilterBenchmark<

0 commit comments

Comments
 (0)