From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 88584 invoked by alias); 21 Jun 2019 17:59:44 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 88571 invoked by uid 89); 21 Jun 2019 17:59:43 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-7.0 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS,UNSUBSCRIBE_BODY autolearn=no version=3.3.1 spammy=HX-Languages-Length:4418, H*c:alternative, yours X-HELO: mail-ua1-f67.google.com Received: from mail-ua1-f67.google.com (HELO mail-ua1-f67.google.com) (209.85.222.67) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 21 Jun 2019 17:59:42 +0000 Received: by mail-ua1-f67.google.com with SMTP id c4so3328776uad.1 for ; Fri, 21 Jun 2019 10:59:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=4m6fJKSFIVMHK3s38stntPBIVKDYAvaLRkbyNH63OPI=; b=Hsnn4pyQZ2i0Mwy0rhUD2IQBZAFQn0aLB3Z7QZhAu7HgvKCvxQIDLOwkz4stL/MPcc o30OGCqzWQyGjESiLeRXoFjfLhXofgqzzlsa7gunv0w7WVUIKox/6fGEbJAeKah3QQMH R6N6CVycyPgK9yGxPtfPXVr7aRRdr7xBL5eNut92BwlwwBQpJ5RNY7ieG0Q+ekcLaBLu 7a8+VUwU9Dn82t5MpUAkEm4Va5QFZGb4KjaazaUC1QbztqyziRhdXfllh6RveCcYhNY8 C6ap99Crcz8TCh2jUnH0TrnQA1Ko13/T8FWoPtu3KaZnboCzoI5CGar5BW0klnPE0l62 BXkA== MIME-Version: 1.0 References: <20190609151704.16061-1-shawn@git.icu> <20190610213017.2021-1-shawn@git.icu> <7afb14c1-ef9e-a0d3-3b46-77793f5a8251@redhat.com> In-Reply-To: <7afb14c1-ef9e-a0d3-3b46-77793f5a8251@redhat.com> From: Shawn Landden Date: Fri, 21 Jun 2019 17:59:00 -0000 Message-ID: Subject: Re: [PATCH v2] Fix slow and non-deterministic behavior of isspace() and tolower() To: Pedro Alves Cc: gdb-patches@sourceware.org, jhb@freebsd.org, eliz@gnu.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-SW-Source: 2019-06/txt/msg00441.txt.bz2 El vie., 21 de jun. de 2019 12:35, Pedro Alves escribi= =C3=B3: > Hi, > > 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/f701531b79380356134d53db97adb6f467f9= d784 > > 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. Cheers. > > I also agree that we don't want to depend on the current > locale when parsing symbol names. > > In my version I was naming the functions gdb_xxx while in > your version you're using xxx_inline. gdb_xxx naming is > more common as a gdb version of some standard function, > so I would prefer that. > > But, meanwhile, last year I merged this patch: > > which touches a somewhat subject. > > 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. > > Least but not least, the patch as is is not following the > GNU/GDB coding format conventions. Take a look here: > > https://sourceware.org/gdb/wiki/ContributionChecklist > > Thanks, > Pedro Alves >