From: Pedro Alves <palves@redhat.com>
To: Hannes Domani <ssbssa@yahoo.de>,
Gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH 1/4] Attribute method inlining
Date: Thu, 21 May 2020 17:42:13 +0100 [thread overview]
Message-ID: <3b5b38b1-ccf2-199b-d2cd-c17e86659000@redhat.com> (raw)
In-Reply-To: <1561975515.2543878.1590073437956@mail.yahoo.com>
On 5/21/20 4:03 PM, Hannes Domani via Gdb-patches wrote:
> Am Donnerstag, 21. Mai 2020, 16:26:12 MESZ hat Pedro Alves <palves@redhat.com> Folgendes geschrieben:
>
>> On 5/21/20 2:08 AM, Hannes Domani via Gdb-patches wrote:
>>
>>> Am Mittwoch, 20. Mai 2020, 19:40:44 MESZ hat Tom Tromey <tromey@adacore.com> Folgendes geschrieben:
>>>
>>>> I ran gdb 10 times like:
>>>>
>>>> /bin/time -f %e \
>>>> ./gdb/gdb --data-directory ./gdb/data-directory -nx \
>>>> -iex 'set debug-file-directory /usr/lib/debug' \
>>>> -batch $X
>>>>
>>>> ... where $X was the test executable. Then I computed the mean time.
>>>> This was all done with a standard (-g -O2) build of gdb.
>>>>
>>>> The baseline times were
>>>>
>>>> gdb 1.90
>>>> libxul 2.12
>>>> Ada 2.61
>>>>
>>>> This patch brings the numbers down to
>>>>
>>>> gdb 1.88
>>>> libxul 2.11
>>>> Ada 2.60
>>>
>>> When I saw this, I thought I could do a similar profiling test on Windows (but
>>> only with gdb itself).
>>>
>>> So just: gdb.exe -q -batch gdb.exe
>>>
>>> And I was a bit suprised to see that strcmp_iw_ordered (called from
>>> sort_pst_symbols -> std::sort) is in ~24% of the profiling samples.
>>> And only because of the functions isspace and tolower.
>>>
>>> So I made a simple test, and added this before strcmp_iw_ordered:
>>>
>>> static inline int isspace2 (int c)
>>> {
>>> return c == 0x20 || (c >= 0x09 && c <= 0x0d);
>>> }
>>> #define isspace isspace2
>>>
>>> static inline int tolower2 (int c)
>>> {
>>> return (c >= 'A' && c <= 'Z') ? c + 0x20 : c;
>>> }
>>> #define tolower tolower2
>>>
>>> And the mean time went from 3.7s down to 2.7s.
>>>
>>>
>>> I'm not saying this is a correct solution, but does strcmp_iw_ordered have to
>>> support anything besides the "C" locale?
>>>
>>> Also, are isspace and tolower only on Windows a bottleneck?
>>>
>>> (If anyone wants to see them, I can provide some profiler flame-graphs)
>>
>>
>> There was a patch for this not that long ago. Let me try to dig it up.
>
> You're right, I found it here:
> https://sourceware.org/pipermail/gdb-patches/2019-June/158285.html
Yes, that's the one!
>
> So I guess it's not just on Windows that slow.
>
> And you replied that we maybe should use TOLOWER, ISXDIGIT from libiberty
> instead:
> https://sourceware.org/pipermail/gdb-patches/2019-June/158518.html
This message is actually older than the patch above -- I wrote the patch
afterwards.
The patch is using the libiberty macros, and avoids the readline clash
you run into. Could you give it a try?
Thanks,
Pedro Alves
>
> I tried to do that, but the safe-ctype.h defines clash with the ones
> of chardefs.h:
>
> In file included from C:/src/repos/binutils-gdb.git/gdb/utils.c:62:
> c:\src\repos\binutils-gdb.git\include\safe-ctype.h:89: error: "ISALPHA" redefined [-Werror]
> 89 | #define ISALPHA(c) _sch_test(c, _sch_isalpha)
> |
> In file included from c:\src\repos\binutils-gdb.git\readline\readline\keymaps.h:35,
> from c:\src\repos\binutils-gdb.git\readline\readline\readline.h:37,
> from C:/src/repos/binutils-gdb.git/gdb/utils.c:61:
> c:\src\repos\binutils-gdb.git\readline\readline\chardefs.h:91: note: this is the location of the previous definition
> 91 | #define ISALPHA(c) (IN_CTYPE_DOMAIN (c) && isalpha ((unsigned char)c))
> |
>
> Not sure how to solve this.
>
next prev parent reply other threads:[~2020-05-21 16:42 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-20 17:40 [PATCH 0/4] Micro-optimize DWARF partial symbol reading Tom Tromey
2020-05-20 17:40 ` [PATCH 1/4] Attribute method inlining Tom Tromey
2020-05-20 19:40 ` Tom Tromey
2020-05-21 1:08 ` Hannes Domani
2020-05-21 14:26 ` Pedro Alves
2020-05-21 15:03 ` Hannes Domani
2020-05-21 16:42 ` Pedro Alves [this message]
2020-05-21 17:18 ` Hannes Domani
2020-05-22 15:47 ` Pedro Alves
2020-05-22 20:28 ` Pedro Alves
2020-05-20 17:40 ` [PATCH 2/4] Lazily compute partial DIE name Tom Tromey
2020-05-20 17:40 ` [PATCH 3/4] Inline abbrev lookup Tom Tromey
2020-05-20 17:40 ` [PATCH 4/4] Use add_partial_symbol in load_partial_dies Tom Tromey
2020-05-20 19:30 ` [PATCH 0/4] Micro-optimize DWARF partial symbol reading Christian Biesinger
2020-05-20 21:08 ` Simon Marchi
2020-05-27 17:48 ` 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=3b5b38b1-ccf2-199b-d2cd-c17e86659000@redhat.com \
--to=palves@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=ssbssa@yahoo.de \
/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