This is the mail archive of the
mailing list for the GDB project.
Re: [PATCH] Fix slow and non-deterministic behavior of isspace() and tolower()
- From: Shawn Landden <slandden at gmail dot com>
- To: Eli Zaretskii <eliz at gnu dot org>
- Cc: gdb-patches at sourceware dot org
- Date: Sun, 9 Jun 2019 10:51:41 -0500
- Subject: Re: [PATCH] Fix slow and non-deterministic behavior of isspace() and tolower()
- References: <firstname.lastname@example.org> <email@example.com>
On Sun, Jun 9, 2019 at 10:42 AM Eli Zaretskii <firstname.lastname@example.org> wrote:
> > From: Shawn Landden <email@example.com>
> > Cc: Shawn Landden <firstname.lastname@example.org>
> > Date: Sun, 9 Jun 2019 10:17:04 -0500
> > 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.
> Instead of inventing our own wheel, how about using the Gnulib's
> c-ctype module?
The tolower() really should only apply to languages that need it, like Ada.
It is kinda a bug to use it with C, which is case sensitive. Also we
probably don't need
the full isspace() either, and these are simple functions. I think it
is much better to be able to
see the full algorithm right in front of you. (even if I just did the
base minimum to speed this up,
without having to study it).