From e3247d3471312a7ca34ac44f44a7d5ac6549660a Mon Sep 17 00:00:00 2001 From: Zygo Blaxell Date: Thu, 1 Nov 2018 14:39:12 -0400 Subject: [PATCH] stats: streamline add_count Perf was blaming BeesStats::add_count for >1% of instructions. Trim the instruction count a little. Signed-off-by: Zygo Blaxell --- src/bees.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/bees.cc b/src/bees.cc index 08c3fd7..467f15f 100644 --- a/src/bees.cc +++ b/src/bees.cc @@ -276,9 +276,10 @@ BeesStatTmpl::add_count(string idx, size_t amount) { unique_lock lock(m_mutex); if (!m_stats_map.count(idx)) { - m_stats_map[idx] = 0; + m_stats_map[idx] = amount; + } else { + m_stats_map[idx] += amount; } - m_stats_map.at(idx) += amount; } template