MCPcopy Create free account
hub / github.com/bytedance/bolt / main

Function main

bolt/exec/benchmarks/HashTableBenchmark.cpp:633–693  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

631 HashTableBenchmarkRun run) {
632 if (!results.empty() && results.back().params.title == run.params.title) {
633 return;
634 }
635 results.push_back(run);
636}
637} // namespace
638
639int main(int argc, char** argv) {
640 // todo: use folly::Init init after upgrade folly lib
641 folly::init(&argc, &argv);
642 memory::MemoryManager::Options options;
643 options.useMmapAllocator = true;
644 options.allocatorCapacity = 10UL << 30;
645 options.useMmapArena = true;
646 options.mmapArenaCapacityRatio = 1;
647 memory::MemoryManager::initialize(options);
648
649 auto bm = std::make_unique<HashTableBenchmark>();
650 std::vector<HashTableBenchmarkRun> results;
651
652 std::vector<HashTableBenchmarkParams> params = {
653 HashTableBenchmarkParams("Hit10K", 10000, 100),
654 HashTableBenchmarkParams("Miss10K", 10000, 5),
655
656 HashTableBenchmarkParams("HitVid10K", 10000, 100, 1000),
657 HashTableBenchmarkParams("MissVid10K", 10000, 5, 1000),
658
659 HashTableBenchmarkParams("Hit4M", 4000000, 100),
660 HashTableBenchmarkParams("Miss4M", 4000000, 5),
661
662 HashTableBenchmarkParams("Hit32M", 32000000, 100),
663 HashTableBenchmarkParams("Miss32M", 32000000, 5),
664
665 HashTableBenchmarkParams("Hit128M", 128000000, 100)};
666 if (FLAGS_bolt_benchmark_custom_size != 0) {
667 params.push_back(HashTableBenchmarkParams(
668 "Custom",
669 FLAGS_bolt_benchmark_custom_size,
670 FLAGS_bolt_benchmark_custom_hit_rate,
671 FLAGS_bolt_benchmark_custom_key_spacing,
672 FLAGS_bolt_benchmark_custom_num_ways));
673 }
674
675 for (auto& param : params) {
676 for (bool enableJit : {false, true}) {
677 param.enableJitRowEqVectors = enableJit;
678 folly::addBenchmark(
679 __FILE__,
680 param.title + (enableJit ? "-jit" : ""),
681 [param, &bm, &results]() {
682 std::string lastCase;
683 if (lastCase != param.title) {
684 lastCase = param.title;
685 folly::BenchmarkSuspender suspender;
686 bm->makeData(param);
687 }
688 combineResults(results, bm->run());
689 return 1;
690 });

Callers

nothing calls this directly

Calls 7

combineResultsFunction · 0.85
runBenchmarksFunction · 0.85
push_backMethod · 0.45
makeDataMethod · 0.45
runMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected