From ea150b0071867557af0a9648936594ab5d5f0d1a Mon Sep 17 00:00:00 2001 From: Dnomd343 Date: Fri, 13 Jan 2023 13:01:13 +0800 Subject: [PATCH] feat: try unordered_map reserve --- src/fast_cal/fast_cal.cc | 5 +++++ src/main.cc | 3 +++ 2 files changed, 8 insertions(+) diff --git a/src/fast_cal/fast_cal.cc b/src/fast_cal/fast_cal.cc index 71dffa2..269f78a 100644 --- a/src/fast_cal/fast_cal.cc +++ b/src/fast_cal/fast_cal.cc @@ -59,6 +59,11 @@ void FastCal::fast_cal(uint64_t code) { // }; // cache.emplace(&cases[code]); +// cases.reserve(30000); + cases.reserve(65536); +// cases.reserve(65536 * 2); +// cases.reserve(65536 * 4); + cache.emplace(&cases.emplace(code, fast_cal_t { .code = code, .mask = 0, diff --git a/src/main.cc b/src/main.cc index f077aec..f98c3bd 100644 --- a/src/main.cc +++ b/src/main.cc @@ -11,6 +11,7 @@ #include #include +#include //void get_status() { // switch (BasicRanges::status()) { @@ -215,5 +216,7 @@ int main() { std::cout << (clock() - start_time) * 1000000 / CLOCKS_PER_SEC << "us" << std::endl; // std::cout << "complete benchmark" << std::endl; +// pause(); + return 0; }