public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug exp/32681] New: [gdb/exp] Improve speed of array element repetition detection
@ 2025-02-11 14:51 vries at gcc dot gnu.org
  2025-02-11 15:15 ` [Bug exp/32681] " vries at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: vries at gcc dot gnu.org @ 2025-02-11 14:51 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=32681

            Bug ID: 32681
           Summary: [gdb/exp] Improve speed of array element repetition
                    detection
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: exp
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

There are a few similar test-cases that print a large, single-value array:
- gdb.ada/huge.exp
- gdb.base/huge.exp
- gdb.fortran/huge.exp

I've just build gdb on an i386-linux setup (N270, 1.6Ghz), with -O0, and ran
into timeouts in these test-cases.

Note that the timeout is already set to 30 seconds in these test-cases, but the
actual time used is more than 60 seconds.

This might be due to building with -O0, I'll try again with -O2.

For gdb.base/huge.exp, my guess is that the majority of the time is spent in
the repetition detection loop in value_print_array_elements:
...
          while (rep1 < len)
            {
              /* When printing large arrays this spot is called frequently, so 
                 clean up temporary values asap to prevent allocating a large  
                 amount of them.  */
              scoped_value_mark free_values_inner;
              struct value *rep_elt
                = val->from_component_bitsize (elttype,
                                               rep1 * bit_stride,
                                               bit_stride);
              bool repeated = ((available
                                && rep_elt->entirely_available ()
                                && element->contents_eq (rep_elt))
                               || (unavailable
                                   && rep_elt->entirely_unavailable ()));
              if (!repeated)
                break;
              ++reps;
              ++rep1;
            }
...

I wonder whether this can be sped up somehow by speculatively looking at more
than one element at a time, and using libc functions to take advantage of
vector instructions.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug exp/32681] [gdb/exp] Improve speed of array element repetition detection
  2025-02-11 14:51 [Bug exp/32681] New: [gdb/exp] Improve speed of array element repetition detection vries at gcc dot gnu.org
@ 2025-02-11 15:15 ` vries at gcc dot gnu.org
  2025-02-11 18:39 ` ssbssa at sourceware dot org
  2025-02-11 18:40 ` vries at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: vries at gcc dot gnu.org @ 2025-02-11 15:15 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=32681

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
Hmm, using 14.2-based system gdb this takes just 9 seconds:
...
$ time gdb -q -batch a.out -ex start -ex "set max-value-size unlimited" -ex
"print a"
Temporary breakpoint 1 at 0x8049173: file src/gdb/testsuite/gdb.base/huge.c,
line 18.

[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/libthread_db.so.1".

Temporary breakpoint 1, main () at src/gdb/testsuite/gdb.base/huge.c:18
18        memcpy (a, b, sizeof (a));
$1 = {0 <repeats 2097152 times>}

real    0m8.832s
user    0m8.397s
sys     0m0.353s
...

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug exp/32681] [gdb/exp] Improve speed of array element repetition detection
  2025-02-11 14:51 [Bug exp/32681] New: [gdb/exp] Improve speed of array element repetition detection vries at gcc dot gnu.org
  2025-02-11 15:15 ` [Bug exp/32681] " vries at gcc dot gnu.org
@ 2025-02-11 18:39 ` ssbssa at sourceware dot org
  2025-02-11 18:40 ` vries at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: ssbssa at sourceware dot org @ 2025-02-11 18:39 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=32681

Hannes Domani <ssbssa at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ssbssa at sourceware dot org

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug exp/32681] [gdb/exp] Improve speed of array element repetition detection
  2025-02-11 14:51 [Bug exp/32681] New: [gdb/exp] Improve speed of array element repetition detection vries at gcc dot gnu.org
  2025-02-11 15:15 ` [Bug exp/32681] " vries at gcc dot gnu.org
  2025-02-11 18:39 ` ssbssa at sourceware dot org
@ 2025-02-11 18:40 ` vries at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: vries at gcc dot gnu.org @ 2025-02-11 18:40 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=32681

--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #0)
> This might be due to building with -O0, I'll try again with -O2.

Indeed, with -O2 all three test pass within the 30 seconds.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-02-11 18:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-02-11 14:51 [Bug exp/32681] New: [gdb/exp] Improve speed of array element repetition detection vries at gcc dot gnu.org
2025-02-11 15:15 ` [Bug exp/32681] " vries at gcc dot gnu.org
2025-02-11 18:39 ` ssbssa at sourceware dot org
2025-02-11 18:40 ` vries at gcc dot gnu.org

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).