Remove temporary stats code from HashMap
This commit is contained in:
parent
f0ae0b8410
commit
f3fdc24383
|
@ -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>
|
||||
void do_profile(size_t count, StringView type)
|
||||
{
|
||||
|
|
|
@ -8,10 +8,6 @@
|
|||
namespace Kakoune
|
||||
{
|
||||
|
||||
class String;
|
||||
|
||||
struct HashStats;
|
||||
|
||||
template<MemoryDomain domain>
|
||||
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<Item, domain> m_items;
|
||||
HashIndex<domain> m_index;
|
||||
|
|
Loading…
Reference in New Issue
Block a user