Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Shawn Landden <slandden@gmail.com>
Cc: gdb-patches@sourceware.org, jhb@freebsd.org, eliz@gnu.org
Subject: Re: [PATCH v2] Fix slow and non-deterministic behavior of isspace() and tolower()
Date: Fri, 21 Jun 2019 18:08:00 -0000	[thread overview]
Message-ID: <dee18d62-cb6d-6e52-e94f-01e2acd9b15c@redhat.com> (raw)
In-Reply-To: <CA+49okqMFvoi0udKXW+RZSMtWhSDpKSPGjjtFqjOsb8wgJsqaQ@mail.gmail.com>

On 6/21/19 6:59 PM, Shawn Landden wrote:
>> On 6/10/19 10:30 PM, Shawn Landden wrote:
>>> I was getting 8% and 6% cpu usage in tolower() and isspace(),
>>> respectively, waiting for a breakpoint on ppc64el.
>>>
>>> Also, gdb doesn't want non-deterministic behavior here.
>>>
>>> v2: do not clash with C99 names
>>
>> When I was working on the C++ wildmatching support a
>> couple years ago, I had some testcases that would stress name
>> parsing that I was running under perf, and I also noticed these functions
>> higher up on the profile.  I wrote a few patches back then:
>>
>>  https://github.com/palves/gdb/commits/palves/ada-decode-speedups
>>
>> And this one has the same idea as yours:
>>
>>
>> https://github.com/palves/gdb/commit/f701531b79380356134d53db97adb6f467f9d784
>>
>> So, I agree that this makes sense.
>>
> I don't care how it gets fixed, and the GNU coding standard (which I write
> to for glibc) will take more time than writing this patch. (Or your
> well-documented response) Also, while I have a copyright assignment for
> glibc, mine for GCC and binutils-gdb is only pending.
> 
> Go ahead and fix this, and give me credit.

The interesting thing to do here is 

 >> That patch uses the existing libiberty uppercase TOLOWER, ISXDIGIT,
 >> etc. macros, which are inline and locale independent by design.
 >> See include/safe-ctype.h.  Can we use those instead of adding new
 >> functions?  I don't recall if I benchmarked ISSPACE vs the gdb_isspace
 >> in that optimization patch on my github, but I think I just didn't
 >> remember ISSPACE back then.

How were you benchmarking this?

Thanks,
Pedro Alves


  reply	other threads:[~2019-06-21 18:08 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-09 15:17 [PATCH] " Shawn Landden
2019-06-09 15:42 ` Eli Zaretskii
2019-06-09 15:51   ` Shawn Landden
2019-06-10 21:14 ` John Baldwin
2019-06-10 21:30 ` [PATCH v2] " Shawn Landden
2019-06-21 17:35   ` Pedro Alves
2019-06-21 17:59     ` Shawn Landden
2019-06-21 18:08       ` Pedro Alves [this message]
2019-06-21 19:20   ` [PATCH] " Shawn Landden
2019-06-21 20:12     ` Pedro Alves
2019-06-21 20:30       ` Shawn Landden
2019-06-21 21:14         ` Pedro Alves

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=dee18d62-cb6d-6e52-e94f-01e2acd9b15c@redhat.com \
    --to=palves@redhat.com \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=jhb@freebsd.org \
    --cc=slandden@gmail.com \
    /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