From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1888) id 84A943858D38; Wed, 3 Jan 2024 16:04:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 84A943858D38 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1704297867; bh=22VL66baLy2kNwjzBOB+L/nbLvUJiDvKUc1xXa7Pddo=; h=From:To:Subject:Date:From; b=VDndVSqKn/cEBTGeCtfa5jdGwecCFvMDFsve2CcBaI/AUOYfoklWSSVMxlHH2sxph l6HRBiTApYcZb3UXCc1VUMoI+/4Ar7N2I9Pz0UQWepTYNa4g5PvgVS9jTuZdTNPWJ4 VBxCFyUuQ9zv6HxPTeQG/IXh5uXx6m88IS57/Wug= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Patrick Palka To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r11-11179] libstdc++: testsuite: Reduce max_size_type.cc exec time [PR113175] X-Act-Checkin: gcc X-Git-Author: Patrick Palka X-Git-Refname: refs/heads/releases/gcc-11 X-Git-Oldrev: 8a731f6e536f88bb04758d613c42b5c1e7f50964 X-Git-Newrev: 2110667d43486174dda37a95f73d71941b394655 Message-Id: <20240103160427.84A943858D38@sourceware.org> Date: Wed, 3 Jan 2024 16:04:27 +0000 (GMT) List-Id: https://gcc.gnu.org/g:2110667d43486174dda37a95f73d71941b394655 commit r11-11179-g2110667d43486174dda37a95f73d71941b394655 Author: Patrick Palka Date: Tue Jan 2 21:31:20 2024 -0500 libstdc++: testsuite: Reduce max_size_type.cc exec time [PR113175] The adjustment to max_size_type.cc in r14-205-g83470a5cd4c3d2 inadvertently increased the execution time of this test by over 5x due to making the two main loops actually run in the signed_p case instead of being dead code. To compensate, this patch cuts the relevant loops' range [-1000,1000] 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 smaller range and/or elsewhere. On my machine this reduces the test's execution time by roughly 10x (and 1.6x relative to 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. (cherry picked from commit a138b99646a5551c53b860648521adb5bfe8c2fa) Diff: --- 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 5130447103f..682d1a99bdc 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;