From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2209) id DAB0A3858D20; Tue, 15 Mar 2022 21:56:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DAB0A3858D20 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="utf-8" From: David Malcolm To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-7658] analyzer: presize m_cluster_map in store copy ctor X-Act-Checkin: gcc X-Git-Author: David Malcolm X-Git-Refname: refs/heads/master X-Git-Oldrev: b5baf569f77e1f172061642d4d8593e1ea737add X-Git-Newrev: a58e342d8869c571476c76d0ed95488adbde26bd Message-Id: <20220315215610.DAB0A3858D20@sourceware.org> Date: Tue, 15 Mar 2022 21:56:10 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Mar 2022 21:56:11 -0000 https://gcc.gnu.org/g:a58e342d8869c571476c76d0ed95488adbde26bd commit r12-7658-ga58e342d8869c571476c76d0ed95488adbde26bd Author: David Malcolm Date: Tue Mar 15 17:55:14 2022 -0400 analyzer: presize m_cluster_map in store copy ctor Testing cc1 on pr93032-mztools-unsigned-char.c Benchmark #1: (without patch) Time (mean ± σ): 338.8 ms ± 13.6 ms [User: 323.2 ms, System: 14.2 ms] Range (min … max): 326.7 ms … 363.1 ms 10 runs Benchmark #2: (with patch) Time (mean ± σ): 332.3 ms ± 12.8 ms [User: 316.6 ms, System: 14.3 ms] Range (min … max): 322.5 ms … 357.4 ms 10 runs Summary ./cc1.new ran 1.02 ± 0.06 times faster than ./cc1.old gcc/analyzer/ChangeLog: * store.cc (store::store): Presize m_cluster_map. Signed-off-by: David Malcolm Diff: --- gcc/analyzer/store.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gcc/analyzer/store.cc b/gcc/analyzer/store.cc index 58df7aab8a2..ec11433dffc 100644 --- a/gcc/analyzer/store.cc +++ b/gcc/analyzer/store.cc @@ -2032,7 +2032,8 @@ store::store () /* store's copy ctor. */ store::store (const store &other) -: m_called_unknown_fn (other.m_called_unknown_fn) +: m_cluster_map (other.m_cluster_map.elements ()), + m_called_unknown_fn (other.m_called_unknown_fn) { for (cluster_map_t::iterator iter = other.m_cluster_map.begin (); iter != other.m_cluster_map.end ();