From patchwork Tue Jan 2 17:48:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Palka X-Patchwork-Id: 184431 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp4626053dyb; Tue, 2 Jan 2024 10:53:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IGfBlZNk3mZ6m0m7AHg+GgHbHBWdBczJt1oQe8kTwA8FEJT52cO73dWq+1+UUeOtHxP4Ctk X-Received: by 2002:ad4:594c:0:b0:67f:8b2c:9494 with SMTP id eo12-20020ad4594c000000b0067f8b2c9494mr31782913qvb.47.1704221586365; Tue, 02 Jan 2024 10:53:06 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1704221586; cv=pass; d=google.com; s=arc-20160816; b=WhmbVHJO/OHjo0OcHvfKzarNG04H6uU7NuJMSXEoJv/7wR+Y+opQQBaZSkJlzTLCVI OFI5JjHpCa0uJ6ISVWL7iXkqbc1EIKYVUWaa3Gz2t+TANW1GbPCfVe99kF/Dee9Q5U/j wgd6sMDcQHji1MBWzljPGqb2BjwqoqR+t2jateWiWrbO1i6Kcr7/Z4dMfFdlgVLj1L8R LYCD01/3AU/BvwZEcP04VWuX8rVDeY8E1kcFMABAGlHScSKeqKPwIQ570ItE/foyFIR5 u/9FInV5FGai88SKue6KFPTPhSyE2hZVrl56fNv8N11r2FWryoLSVXlvQojXrweomvd9 zloQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=cwctE0gBEOXzclaOtIPuZZ7EaZWG6SxwUzCChg40eK8=; fh=S/JIUgwyA2yYcdyiYB6UtckyqjE9wfGfNWTu+Kkj2Is=; b=oqpw0Zdl3RRYfzfysPIgoa6nGyxowrXIWrTegrw/Hp/s034gZyU98XsSY+FFHvYd/u 72Zsjs6mFDuKOTDUKInyjzjwhL3rqmZ3sM9CWS7HfeShFLo42QYl7efMv2zQm8VFVtFi SxaJX8uTIWcBJM5bhYS7QBF8y4Z9rikntWek3NkaHvL/NdtaNbmcPhCWRTbZgLFmF91C 6rb+rYhzWh7jTbYyfcKRrhkI0hirdZRE5eavT3N2orbuYW3/3yzsoMBt6S7ig6XRAUOB hM/NBFWCPBz847qUGBAhiFcDJ4p/o3JqlrvrAs5T6Xz40DdMGEL7jzQYgfrAqD4rf9eN RO1A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ZXDUKnwx; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id h7-20020a0cf407000000b0067f886473besi26205585qvl.76.2024.01.02.10.53.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 10:53:06 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ZXDUKnwx; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8F9A13857C52 for ; Tue, 2 Jan 2024 17:49:20 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id F13673858401 for ; Tue, 2 Jan 2024 17:48:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F13673858401 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org F13673858401 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704217714; cv=none; b=OctHiNFJXkg1K65MxOtXGEAWO8Tr5aEuEq4JcCCIxmHly7K50McDGLGOfBSMDeY3Zl+bgmR19audkSjXah+scKAFh/9CsIyPDO7RX2jRxSHcGXkWOpFspaKAh89XszTkf2x62S5NTNd5aOWApqL9n8gQ/NcGIme5nZxJdDm5bkA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704217714; c=relaxed/simple; bh=82GGvgdHYjeiuMJ4kWHd8nt9L9PyIe0YmC+JrOy7vtQ=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=aDurRqb4O8oN2oA4PNOa6WQbORvZcJZpiisxtt9sJW3G1OnnujrP6BE2yuqJMstA67u7paKUnopEbi/s8klSJg666dpJCf6pLoDpPZe4X3RBDt/dpUGlTq6LS2XkPUMwZ/SrIvubT/9d2wY2gWNvgXQjcn4htL3lkLuUXTWszjU= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704217712; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=cwctE0gBEOXzclaOtIPuZZ7EaZWG6SxwUzCChg40eK8=; b=ZXDUKnwxAO6vcB/0gNCHdUIqHzRsvhXiUL9jl8MT6WHiLq3gzyNupLaU47wkdaV8Iba/hj wMtYOS9AE+pMMr2cDaJsVOXIDMcmIcu/qwxEBlDzkya2SlyICO6srzcwNOfWtkVR4+TRuK S/cHzanG35kddjB8s+Pd+CgyCSC3QPg= Received: from mail-yw1-f200.google.com (mail-yw1-f200.google.com [209.85.128.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-516-yuZCaLeRNo6EX7GyY6wa5g-1; Tue, 02 Jan 2024 12:48:31 -0500 X-MC-Unique: yuZCaLeRNo6EX7GyY6wa5g-1 Received: by mail-yw1-f200.google.com with SMTP id 00721157ae682-5eb6dba1796so130744817b3.1 for ; Tue, 02 Jan 2024 09:48:31 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704217710; x=1704822510; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=cwctE0gBEOXzclaOtIPuZZ7EaZWG6SxwUzCChg40eK8=; b=k8eSLzhQcMqRcAGS2glLrKFysSp8GGEFU/9kNSwMPjzVSG9JfVqKOKSu1BI+AXJyRV JphNoVo9jNUDvsIcngBKJtzK9jRP/ZqdOeWCkg+MbNgxwirx5d1/BLnCfoYQQRzisQx2 5vYB/iV9N6OMO/cp2GgHXKzYH4Wrz/c/sK/8kKIqlssn+CjC7XTbT95EWi10rt8iYDlQ rfFCgo5eVFppD47uLYtQzFFenApiwhu3a5h+hcBNIR5O87PA0WjgOl8OM7Q5pAzcET13 owKFfpaHFQ+eQ9kyJ/uf0YlsBIYgzmLCD5UkyvDY7LYbxKdptXefsr0om7ftytCKE9S6 uIrg== X-Gm-Message-State: AOJu0YxDXLAzWekTgmk8Knc4RFMnAJ4JVbHzlKZkS17P43vXQh/NjpO9 gBNrrRUJ5wgq0RDtYFXiW+A0XSw2HzGeXHGi9LPKR5qEQZpyDNl0fKLW/qN6CExWYgJWOc7zaAK eFb+ErLbMzhjQFfZ+NRonCEGFQTgsas6R72skLXynn1fZZ4ZWEmQLQS49d2tQB/7EQrCqOYK9Aa +eixVkTsg= X-Received: by 2002:a25:ef4c:0:b0:dbc:e80b:7103 with SMTP id w12-20020a25ef4c000000b00dbce80b7103mr8418320ybm.80.1704217710702; Tue, 02 Jan 2024 09:48:30 -0800 (PST) X-Received: by 2002:a25:ef4c:0:b0:dbc:e80b:7103 with SMTP id w12-20020a25ef4c000000b00dbce80b7103mr8418310ybm.80.1704217710410; Tue, 02 Jan 2024 09:48:30 -0800 (PST) Received: from localhost.localdomain (ool-457670bb.dyn.optonline.net. [69.118.112.187]) by smtp.gmail.com with ESMTPSA id do14-20020a05622a478e00b00423e8909bfesm13172016qtb.6.2024.01.02.09.48.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 09:48:30 -0800 (PST) From: Patrick Palka To: gcc-patches@gcc.gnu.org Cc: libstdc++@gcc.gnu.org, hp@bitrange.com, Patrick Palka Subject: [PATCH] libstdc++: testsuite: reduce max_size_type.cc exec time [PR113175] Date: Tue, 2 Jan 2024 12:48:26 -0500 Message-ID: <20240102174826.1868173-1-ppalka@redhat.com> X-Mailer: git-send-email 2.43.0.232.ge79552d197 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-14.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787005854032738883 X-GMAIL-MSGID: 1787005854032738883 Tested on x86_64-pc-linux-gnu, does this look OK for trunk and release branches (r14-205 was backported everywhere)? -- >8 -- The adjustment to max_size_type.cc in r14-205-g83470a5cd4c3d2 inadvertently increased the execution time of the test by over 5x due to enabling the two main loops to actually run in the signed_p case instead of being dead code. This suggests that the current range of the loop is far too big and the test too time consuming, especially when run on simulators. So this patch cuts the loop range by 10x as proposed in the PR. This shouldn't significantly weaken the test since the same important edge cases are still checked in the new range. On my x86_64 machine this reduces the test execution time by 10x, and 1.6x less time than before r14-205. PR testsuite/113175 libstdc++-v3/ChangeLog: * testsuite/std/ranges/iota/max_size_type.cc (test02): Reduce 'limit' to 100 from 1000 and adjust 'log2_limit' accordingly. (test03): Likewise. --- libstdc++-v3/testsuite/std/ranges/iota/max_size_type.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libstdc++-v3/testsuite/std/ranges/iota/max_size_type.cc b/libstdc++-v3/testsuite/std/ranges/iota/max_size_type.cc index a1fbc3241dc..27f25c758fe 100644 --- a/libstdc++-v3/testsuite/std/ranges/iota/max_size_type.cc +++ b/libstdc++-v3/testsuite/std/ranges/iota/max_size_type.cc @@ -199,8 +199,8 @@ test02() using max_type = std::conditional_t; using shorten_type = std::conditional_t; const int hw_type_bit_size = sizeof(hw_type) * __CHAR_BIT__; - const int limit = 1000; - const int log2_limit = 10; + const unsigned limit = 100; + const int log2_limit = 7; static_assert((1 << log2_limit) >= limit); const int min = (signed_p ? -limit : 0); const int max = limit; @@ -257,8 +257,8 @@ test03() using max_type = std::conditional_t; using base_type = std::conditional_t; constexpr int hw_type_bit_size = sizeof(hw_type) * __CHAR_BIT__; - constexpr int limit = 1000; - constexpr int log2_limit = 10; + constexpr unsigned limit = 100; + constexpr int log2_limit = 7; static_assert((1 << log2_limit) >= limit); const int min = (signed_p ? -limit : 0); const int max = limit;