public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
From: Patrick Palka <ppalka@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org
Subject: [gcc r12-10079] libstdc++: testsuite: Reduce max_size_type.cc exec time [PR113175]
Date: Wed,  3 Jan 2024 16:00:56 +0000 (GMT)	[thread overview]
Message-ID: <20240103160056.BE3083858D38@sourceware.org> (raw)

https://gcc.gnu.org/g:1fb2b5c9a7fb212a5936cc702e49175ef988e5ad

commit r12-10079-g1fb2b5c9a7fb212a5936cc702e49175ef988e5ad
Author: Patrick Palka <ppalka@redhat.com>
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 5fc798cc60d..5c41b5629b0 100644
--- a/libstdc++-v3/testsuite/std/ranges/iota/max_size_type.cc
+++ b/libstdc++-v3/testsuite/std/ranges/iota/max_size_type.cc
@@ -200,8 +200,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;
@@ -258,8 +258,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;

                 reply	other threads:[~2024-01-03 16:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240103160056.BE3083858D38@sourceware.org \
    --to=ppalka@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    --cc=libstdc++-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).