From nobody Wed Nov 5 13:13:05 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 1534549752534536.2361904855577; Fri, 17 Aug 2018 16:49:12 -0700 (PDT) Received: from localhost ([::1]:36811 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fqoUR-0000RO-96 for importer@patchew.org; Fri, 17 Aug 2018 19:49:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57651) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fqoPA-0004rh-Js for qemu-devel@nongnu.org; Fri, 17 Aug 2018 19:43:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fqoBk-0003I6-7C for qemu-devel@nongnu.org; Fri, 17 Aug 2018 19:29:55 -0400 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:36437) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fqoBk-0003Ht-1i for qemu-devel@nongnu.org; Fri, 17 Aug 2018 19:29:52 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id CFE41225FB; Fri, 17 Aug 2018 19:29:51 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Fri, 17 Aug 2018 19:29:51 -0400 Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 8022510268; Fri, 17 Aug 2018 19:29:51 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=mesmtp; bh=BQcF4PFVHCj9gA rphkYuadyNhi7MG9O2sAt3oKKn92w=; b=dyUUdgEe0SWpQWmiuzhlHYcJtWRivs CgZDLuYVu2KOzwyL2H8Mem2xCtp+hte8gUHd3FWpBDhW2V1al0hYqhjyxArfz/SA y+aIYImbDK8umbb1TMh7XxQHFdLqWb5DtZzKT3NwGFRObnoEZPIhDLpiGYPU3BTr uNFfnykRfpg44= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=BQcF4PFVHCj9gArphkYuadyNhi7MG9O2sAt3oKKn92w=; b=RSQ10zhl RXJCb9iJl24ws1A5y/GA25qS/9PkxyGb08O1WVKupm0FIRw7oaVv1OdArwlbpyXQ s8vXhXFjZgVY0kXQ40LwQimzK4EzGzMYP74Vy+YtZcH/bLIyRhho6p7D6sDJSkdj VHrT08oufAE/FvjvaZQ+Y++IzA1OonK3klI9RN2F4r+NZaeKd4QTRSoQTe+W3cw4 5B2ipBXPbItUwMEM71cmrMN8nCWYbZnkdOFKU3X8cd9uws7eUtZJagSf/dhIaAxl 16j4A8fZSbKXpNWcpotb96dv6iRid4CAychK48TriqEkLKTUyu/dCFbZd7lSpxqP 4aAdDru1rQdN/g== X-ME-Proxy: X-ME-Sender: From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Fri, 17 Aug 2018 19:29:23 -0400 Message-Id: <20180817232923.28899-7-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180817232923.28899-1-cota@braap.org> References: <20180817232923.28899-1-cota@braap.org> 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 6/6] 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 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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. Signed-off-by: Emilio G. Cota Reviewed-by: Alex Benn=C3=A9e --- 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