From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18854 invoked by alias); 9 Jun 2019 15:51:55 -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 18846 invoked by uid 89); 9 Jun 2019 15:51:55 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-8.9 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=U*eliz, eliz@gnu.org, HTo:U*eliz, elizgnuorg X-HELO: mail-ua1-f65.google.com Received: from mail-ua1-f65.google.com (HELO mail-ua1-f65.google.com) (209.85.222.65) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 09 Jun 2019 15:51:54 +0000 Received: by mail-ua1-f65.google.com with SMTP id j8so2219041uan.6 for ; Sun, 09 Jun 2019 08:51:54 -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=Gnb+tMjs1JRvprhGeurTF4XKqId2YLvXMyimpRqUJ8k=; b=kBTvdSLUFTfWCA1F72K9z9F7XzddfRqE9revObJWhuZNYepOvCXW14SaC/j9xa7sR/ AQmr0HNTKtQDH11UzXLdcp3hGXqAYpyv00+1JA+Vj3+rivWzrNkXxnN+u+F2DvVOI1LT kszq0XmPXX4qB+sBzcXHySqEZ7H6cPwtHCEWBvgw3s+EjUClKrPoKYzNPAxRCYyaEcn1 z8tgJwyPpNnXDZ02fO9fTKzqUe6x4BZYpYIlSebotA/6kfEmuuPZ7z//kZHW1ewBGQ6p dTm8A+mEffCazAA2C8bl/xffXnnKhIkLaF+vC3em1oh4IvWVvqVPIkX+kwxqunD6ShQp w/bQ== MIME-Version: 1.0 References: <20190609151704.16061-1-shawn@git.icu> <83h88ybwab.fsf@gnu.org> In-Reply-To: <83h88ybwab.fsf@gnu.org> From: Shawn Landden Date: Sun, 09 Jun 2019 15:51:00 -0000 Message-ID: Subject: Re: [PATCH] Fix slow and non-deterministic behavior of isspace() and tolower() To: Eli Zaretskii Cc: gdb-patches@sourceware.org Content-Type: text/plain; charset="UTF-8" X-SW-Source: 2019-06/txt/msg00190.txt.bz2 On Sun, Jun 9, 2019 at 10:42 AM Eli Zaretskii wrote: > > > From: Shawn Landden > > Cc: Shawn Landden > > 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). -Shawn Landden