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: 1881701 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=ZXDUKnwx; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4T4L236Rvsz23dJ for ; Wed, 3 Jan 2024 04:48:59 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AAD2638582AE for ; Tue, 2 Jan 2024 17:48:57 +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-Google-Smtp-Source: AGHT+IEMAqWj4msDZz3NnyGAY/knSMm1zrFlS60fLeLctJFdHIHTfbUV3yQOomuFF1ERjpp1Qom/iw== 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+incoming=patchwork.ozlabs.org@gcc.gnu.org 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;