From nobody Wed Nov 5 13:32:32 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1536606477944311.28467090664856; Mon, 10 Sep 2018 12:07:57 -0700 (PDT) Received: from localhost ([::1]:53570 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fzRXQ-0007fr-VP for importer@patchew.org; Mon, 10 Sep 2018 15:07:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49200) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fzRPS-0001JC-CT for qemu-devel@nongnu.org; Mon, 10 Sep 2018 14:59:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fzRPQ-0001F5-G1 for qemu-devel@nongnu.org; Mon, 10 Sep 2018 14:59:41 -0400 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:47803) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fzRPQ-00013K-1y for qemu-devel@nongnu.org; Mon, 10 Sep 2018 14:59:40 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id BA6D321F3A; Mon, 10 Sep 2018 14:59:07 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Mon, 10 Sep 2018 14:59:07 -0400 Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 62E5B102AA; Mon, 10 Sep 2018 14:59:07 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=mesmtp; bh=6BL/3joOqPSUYInxy9V+VS1rnR 71YW2beJNdmGlVusk=; b=rfuhNJcxAi4ZoxF9uEHqK2VfflUlz5S5G/CdTRkPrw GBOnarOksW1ohr1fSc7F4KaFkFakpqN4DhPsVcwFWmxN9Tcn+/801rSEQiuIYxU5 LTVgD/+oSFCqtwDJZ841kmIypms6pjsGSHc3YNaPSzSxCZoeRrX3QpDqGzlrbwbu U= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=6BL/3j oOqPSUYInxy9V+VS1rnR71YW2beJNdmGlVusk=; b=HyU9SRsw3A01WUpPDRqf4T hte1LzE0B3whXad2j0ka2KLBiUiMZOvKtxHhQDfm+j/DtIT51BhvewMpmhgGw/SB NqKX+wGlRJXDTmCGnvqoDsyvasYLt8hmoj+ES0PUcRKAjckkJACmc7/45/2MwqxG 4SS4pG8R59RRmLJSRcKQ/Y5Oslgqrfze3MfKkg1xrphS2Eaq7/gVoQB9u2caJnNK JmQWl8nRi+c3uBN8QDdIl592WFua+T9nZ5DdzeKxTKZ69w9eIVsjbEAGwNoGSTPo IQ8YVqnK4+C4jCmDD4idkmXPQaX7nX/9qvx+5F07LwLcLzeGERzSaj4znwrgbTHg == X-ME-Proxy: X-ME-Sender: From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Mon, 10 Sep 2018 14:58:53 -0400 Message-Id: <20180910185859.27917-7-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180910185859.27917-1-cota@braap.org> References: <20180910185859.27917-1-cota@braap.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.25 Subject: [Qemu-devel] [PATCH v2 06/12] test-qht: speed up + test qht_resize X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Perform first the tests that exercise code paths that are easier to hit at small table sizes, and then resize the table to speed up subsequent tests. If this resize is not too large, we can make the test faster with no code coverage loss. - With gcov enabled: Before: 20.568s, 90.28% qht.c coverage After: 5.168s, 93.06% qht.c coverage The coverage increase is entirely due to calling qht_resize, which we weren't calling before. Note that the code paths that remain to be tested are either error handling or can only occur when several threads are accessing the hash table concurrently (e.g. seqlock retry, trylock fail). - Without gcov: Before: 1.987s After: 0.528s The speedup is almost the same as with gcov, although the "before" run is a lot faster. Reviewed-by: Alex Benn=C3=A9e Signed-off-by: Emilio G. Cota --- tests/test-qht.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/test-qht.c b/tests/test-qht.c index 77666e8c5f..1ec039d636 100644 --- a/tests/test-qht.c +++ b/tests/test-qht.c @@ -189,6 +189,10 @@ static void qht_do_test(unsigned int mode, size_t init= _entries) rm_nonexist(7, 8); iter_rm_mod(1); =20 + if (!(mode & QHT_MODE_AUTO_RESIZE)) { + qht_resize(&ht, init_entries * 4 + 4); + } + check_n(0); rm_nonexist(0, 10); insert(0, N); --=20 2.17.1