From f3fdc2438362d6ec46c6e6989fc03c041dfde47a Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Tue, 7 Mar 2017 01:15:41 +0000 Subject: [PATCH] Remove temporary stats code from HashMap --- src/hash_map.cc | 33 --------------------------------- src/hash_map.hh | 7 ------- 2 files changed, 40 deletions(-) diff --git a/src/hash_map.cc b/src/hash_map.cc index 4db90f8c..4220d17e 100644 --- a/src/hash_map.cc +++ b/src/hash_map.cc @@ -79,39 +79,6 @@ UnitTest test_hash_map{[] { } }}; -struct HashStats -{ - size_t max_dist; - float mean_dist; - float fill_rate; -}; - -template -HashStats HashIndex::compute_stats() const -{ - size_t count = 0; - size_t max_dist = 0; - size_t sum_dist = 0; - for (size_t slot = 0; slot < m_entries.size(); ++slot) - { - auto& entry = m_entries[slot]; - if (entry.index == -1) - continue; - ++count; - auto dist = slot - compute_slot(entry.hash); - max_dist = std::max(max_dist, dist); - sum_dist += dist; - } - - return { max_dist, (float)sum_dist / count, (float)count / m_entries.size() }; -} - -template -HashStats HashMap::compute_stats() const -{ - return m_index.compute_stats(); -} - template void do_profile(size_t count, StringView type) { diff --git a/src/hash_map.hh b/src/hash_map.hh index df8fd306..47a50cd8 100644 --- a/src/hash_map.hh +++ b/src/hash_map.hh @@ -8,10 +8,6 @@ namespace Kakoune { -class String; - -struct HashStats; - template struct HashIndex { @@ -120,8 +116,6 @@ struct HashIndex void clear() { m_entries.clear(); } - HashStats compute_stats() const; - private: size_t m_count = 0; float m_max_fill_rate = 0.5f; @@ -284,7 +278,6 @@ struct HashMap return not (*this == other); } - HashStats compute_stats() const; private: Vector m_items; HashIndex m_index;