From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by sourceware.org (Postfix) with ESMTP id 289543840C3E for ; Thu, 21 May 2020 16:42:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 289543840C3E Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-154-VpzohB1QPEupqp4bFVcpDA-1; Thu, 21 May 2020 12:42:17 -0400 X-MC-Unique: VpzohB1QPEupqp4bFVcpDA-1 Received: by mail-wr1-f70.google.com with SMTP id q13so3156518wrn.14 for ; Thu, 21 May 2020 09:42:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=hpguB6z5k9401YDkE4Ljk9Tkyg9IfqmOIcf9WSN1vcc=; b=ZbbHOVh5vtG1x6VRRBww/dzR/5ZpGzWnMo5940mVUHXhiXHxeRlSnFWsjWnoC+xy0L IWZvq1V9ZX7bKalUBTnV8xSAWk8+x6RAxWlc6HKaWgdyoWnylWPZ2gkGxJst12cqdVfB Oo+oAD/SdduFode7N6Y4+DYcfhMHD2w+33pbOsXKyLbmcTcnQEh4YP8hnvXLRtzVahpR 8+xNBwjdkyEw0Sim/d0XETQx5EmYOV50FVzrHCF6ysT8vaI4gV5T3HR4VGb5K8BhXDzE CZhlpLcGFTB1mpqutw0ycuEm7ayRwNL07dNzkgapXQPR1lRhBeHCDK4gqsQvOUK/tC8c Irfg== X-Gm-Message-State: AOAM5333nkagDzGCjAfh79C9a4ROkpelQFkbvoW/YVreXvKt7jT8aLJK uqrHs3a6ux7YhssqtxoJf+Q86mQXyPCxH4sOigVKxrwIolcUeoPrtXZPBxJ0QUdLArJer7+FnLx 7e1uKmuMJK+x6+EZnctlGsg== X-Received: by 2002:a7b:c939:: with SMTP id h25mr9570446wml.9.1590079336362; Thu, 21 May 2020 09:42:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwE2cjNP2b0oVt+T5a2bgnUtR1NMRVkkQOpbAPaVFSSzFNk/tsjvQA2wsz6x36wa9fZGbWu3Q== X-Received: by 2002:a7b:c939:: with SMTP id h25mr9570433wml.9.1590079336085; Thu, 21 May 2020 09:42:16 -0700 (PDT) Received: from ?IPv6:2001:8a0:f909:7b00:2327:23ca:3e56:ef5f? ([2001:8a0:f909:7b00:2327:23ca:3e56:ef5f]) by smtp.gmail.com with ESMTPSA id x10sm7252936wrn.54.2020.05.21.09.42.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 21 May 2020 09:42:15 -0700 (PDT) Subject: Re: [PATCH 1/4] Attribute method inlining To: Hannes Domani , Gdb-patches References: <20200520174032.9525-1-tromey@adacore.com> <20200520174032.9525-2-tromey@adacore.com> <402931801.2106918.1590023319120@mail.yahoo.com> <57ffa2a6-6636-d50c-a058-5244c41e0e96@redhat.com> <1561975515.2543878.1590073437956@mail.yahoo.com> From: Pedro Alves Message-ID: <3b5b38b1-ccf2-199b-d2cd-c17e86659000@redhat.com> Date: Thu, 21 May 2020 17:42:13 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <1561975515.2543878.1590073437956@mail.yahoo.com> Content-Language: en-US X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.5 required=5.0 tests=BAYES_00, BODY_8BITS, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 May 2020 16:42:24 -0000 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 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 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. >