From: Andrew Gontarek <andrewg@cray.com>
To: gdb-patches@sourceware.org
Subject: [PATCH] Bug 12705: Extremely poor performance when printing large arrays
Date: Tue, 26 Apr 2011 17:26:00 -0000 [thread overview]
Message-ID: <4DB70027.2040006@cray.com> (raw)
Hello,
I noticed that when I wanted to print out a very large array, the
performance
was unbearably slow. This can be observed by setting print repeats and print
elements to 0 (unlimited) and then attempting to print a large array.
set print repeats 0
set print elements 0
I discovered this behavior while attempting to directly parse a very large
array's value directly using gdb/mi with the command
-data-evaluate-expression.
The following is a patch which fixes this issue:
Index: valprint.c
===================================================================
RCS file: /cvs/src/src/gdb/valprint.c,v
retrieving revision 1.110
diff -c -p -r1.110 valprint.c
*** valprint.c 14 Feb 2011 11:35:45 -0000 1.110
--- valprint.c 26 Apr 2011 16:57:39 -0000
*************** val_print_array_elements (struct type *t
*** 1247,1261 ****
rep1 = i + 1;
reps = 1;
! while (rep1 < len
&& value_available_contents_eq (val,
embedded_offset + i *
eltlen,
val,
embedded_offset + rep1 *
eltlen,
eltlen))
! {
! ++reps;
! ++rep1;
}
if (reps > options->repeat_count_threshold)
--- 1247,1267 ----
rep1 = i + 1;
reps = 1;
!
! /* Only check for reps if repeat_count_threshold is not set to
! UINT_MAX (unlimited) */
! if (options->repeat_count_threshold < UINT_MAX)
! {
! while (rep1 < len
&& value_available_contents_eq (val,
embedded_offset + i * eltlen,
val,
embedded_offset + rep1 *
eltlen,
eltlen))
! {
! ++reps;
! ++rep1;
! }
}
if (reps > options->repeat_count_threshold)
Index: ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/ChangeLog,v
retrieving revision 1.12951
diff -c -p -r1.12951 ChangeLog
*** ChangeLog 26 Apr 2011 15:40:56 -0000 1.12951
--- ChangeLog 26 Apr 2011 17:13:39 -0000
***************
*** 1,3 ****
--- 1,9 ----
+ 2011-04-26 Andrew Gontarek <andrewg@cray.com>
+
+ * valprint.c (val_print_array_elements): Fixed poor performance
+ of printing very large arrays with repeat_count_threshold set
+ to unlimited. New comment.
+
2011-04-26 Michael Walle <michael@walle.cc>
* remote.c (remote_start_remote): Ack packet after sending the
--
Andrew Gontarek
PE debugger development at CRAY
Ph: 651-605-9176
next reply other threads:[~2011-04-26 17:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-26 17:26 Andrew Gontarek [this message]
2011-04-29 17:41 ` Tom Tromey
2011-04-29 19:15 ` Tom Tromey
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=4DB70027.2040006@cray.com \
--to=andrewg@cray.com \
--cc=gdb-patches@sourceware.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