aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Palka <ppalka@redhat.com>2024-01-02 21:31:20 -0500
committerPatrick Palka <ppalka@redhat.com>2024-01-02 21:31:20 -0500
commita138b99646a5551c53b860648521adb5bfe8c2fa (patch)
tree38a6ba0a7a211a84e750410e6d45cdfa538e0134
parent45c807b79479a725c968db638ddd0fd5f25deeaa (diff)
downloadgcc-a138b99646a5551c53b860648521adb5bfe8c2fa.zip
gcc-a138b99646a5551c53b860648521adb5bfe8c2fa.tar.gz
gcc-a138b99646a5551c53b860648521adb5bfe8c2fa.tar.bz2
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.
-rw-r--r--libstdc++-v3/testsuite/std/ranges/iota/max_size_type.cc8
1 files 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 a1fbc3241..27f25c7 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<signed_p, max_diff_t, max_size_t>;
using shorten_type = std::conditional_t<shorten_p, hw_type, max_type>;
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<signed_p, max_diff_t, max_size_t>;
using base_type = std::conditional_t<toggle_base_p, hw_type, max_type>;
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;