Remove temporary stats code from HashMap

This commit is contained in:
Maxime Coste 2017-03-07 01:15:41 +00:00
parent f0ae0b8410
commit f3fdc24383
2 changed files with 0 additions and 40 deletions

View File

@ -79,39 +79,6 @@ UnitTest test_hash_map{[] {
} }
}}; }};
struct HashStats
{
size_t max_dist;
float mean_dist;
float fill_rate;
};
template<MemoryDomain domain>
HashStats HashIndex<domain>::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<typename Key, typename Value, MemoryDomain domain>
HashStats HashMap<Key, Value, domain>::compute_stats() const
{
return m_index.compute_stats();
}
template<typename Map> template<typename Map>
void do_profile(size_t count, StringView type) void do_profile(size_t count, StringView type)
{ {

View File

@ -8,10 +8,6 @@
namespace Kakoune namespace Kakoune
{ {
class String;
struct HashStats;
template<MemoryDomain domain> template<MemoryDomain domain>
struct HashIndex struct HashIndex
{ {
@ -120,8 +116,6 @@ struct HashIndex
void clear() { m_entries.clear(); } void clear() { m_entries.clear(); }
HashStats compute_stats() const;
private: private:
size_t m_count = 0; size_t m_count = 0;
float m_max_fill_rate = 0.5f; float m_max_fill_rate = 0.5f;
@ -284,7 +278,6 @@ struct HashMap
return not (*this == other); return not (*this == other);
} }
HashStats compute_stats() const;
private: private:
Vector<Item, domain> m_items; Vector<Item, domain> m_items;
HashIndex<domain> m_index; HashIndex<domain> m_index;