From 2b132ae892100532007f8eb234fcc040e4ab8094 Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Mon, 9 Sep 2013 07:23:56 -0700 Subject: [PATCH] Tune HashMap parameters --- modules/beast_core/containers/HashMap.cpp | 7 ++++++- modules/beast_core/containers/HashMap.h | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/beast_core/containers/HashMap.cpp b/modules/beast_core/containers/HashMap.cpp index b4e4b629be..451a316d26 100644 --- a/modules/beast_core/containers/HashMap.cpp +++ b/modules/beast_core/containers/HashMap.cpp @@ -130,7 +130,12 @@ public: for (std::size_t i = 0; i < numberOfKeys; ++i) map.insert (traits.getKey (i)); - this->logMessage ("load_factor = " + String::fromNumber (map.load_factor ())); + String s ( + "load_factor = " + String::fromNumber (map.load_factor (), 2) + + ", bucket_count = " + String::fromNumber (map.bucket_count ())); + this->logMessage (s); + + expect (map.size () == numberOfKeys); } void runTest () diff --git a/modules/beast_core/containers/HashMap.h b/modules/beast_core/containers/HashMap.h index 95dd1f4dcf..e1f46f5a07 100644 --- a/modules/beast_core/containers/HashMap.h +++ b/modules/beast_core/containers/HashMap.h @@ -443,7 +443,7 @@ public: enum { initialBucketCount = 101, - percentageIncrease = 75 + percentageIncrease = 25 }; static float getDefaultLoadFactor () noexcept