From 445af8a6d7c1865e86d988839b261de54c4833b7 Mon Sep 17 00:00:00 2001 From: Joel Rosdahl Date: Mon, 5 Sep 2022 13:17:26 +0200 Subject: [PATCH] enhance: Short circuit StatisticsCounters::increment for zero value --- src/core/StatisticsCounters.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/core/StatisticsCounters.cpp b/src/core/StatisticsCounters.cpp index 5bef84383..3f1f2d656 100644 --- a/src/core/StatisticsCounters.cpp +++ b/src/core/StatisticsCounters.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2010-2021 Joel Rosdahl and other contributors +// Copyright (C) 2010-2022 Joel Rosdahl and other contributors // // See doc/AUTHORS.adoc for a complete list of contributors. // @@ -78,6 +78,9 @@ StatisticsCounters::set_raw(size_t index, uint64_t value) void StatisticsCounters::increment(Statistic statistic, int64_t value) { + if (value == 0) { + return; + } const auto i = static_cast(statistic); if (i >= m_counters.size()) { m_counters.resize(i + 1); -- 2.47.2