Skip to content

Commit

Permalink
Optimize vote_cache::collect_container_info (#4644)
Browse files Browse the repository at this point in the history
  • Loading branch information
pwojcikdev authored May 25, 2024
1 parent 30f2de0 commit 166920f
Showing 1 changed file with 0 additions and 13 deletions.
13 changes: 0 additions & 13 deletions nano/node/vote_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,21 +276,8 @@ std::unique_ptr<nano::container_info_component> nano::vote_cache::collect_contai
{
nano::lock_guard<nano::mutex> guard{ mutex };

auto count_unique_votes = [this] () {
std::unordered_set<std::shared_ptr<nano::vote>> votes;
for (auto const & entry : cache)
{
for (auto const & vote : entry.votes ())
{
votes.insert (vote);
}
}
return votes.size ();
};

auto composite = std::make_unique<container_info_composite> (name);
composite->add_component (std::make_unique<container_info_leaf> (container_info{ "cache", cache.size (), sizeof (ordered_cache::value_type) }));
composite->add_component (std::make_unique<container_info_leaf> (container_info{ "unique", count_unique_votes (), sizeof (nano::vote) }));
return composite;
}

Expand Down

0 comments on commit 166920f

Please sign in to comment.