From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.devel Subject: Changes in GC and in pure space Date: Thu, 5 Sep 2019 00:04:32 -0700 Organization: UCLA Computer Science Department Message-ID: <3306cfce-7bdf-850b-74bf-e03be28e984e@cs.ucla.edu> References: <20190721193221.1964.53182@vcs0.savannah.gnu.org> <20190721193222.8C19E20BE2@vcs0.savannah.gnu.org> <83blxmqfkq.fsf@gnu.org> <9568ca7d-854f-1971-bbe8-03ba8c64af42@cs.ucla.edu> <83o9006rol.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------C379E03AD4D1065A567CE0C0" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="90756"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 Cc: Eli Zaretskii , dancol@dancol.org, pipcet@gmail.com, emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Sep 05 09:04:49 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1i5lp2-000NTb-IF for ged-emacs-devel@m.gmane.org; Thu, 05 Sep 2019 09:04:48 +0200 Original-Received: from localhost ([::1]:42766 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5lp0-0002rX-PQ for ged-emacs-devel@m.gmane.org; Thu, 05 Sep 2019 03:04:46 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43411) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5lou-0002r3-1M for emacs-devel@gnu.org; Thu, 05 Sep 2019 03:04:41 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i5los-0007NK-D5 for emacs-devel@gnu.org; Thu, 05 Sep 2019 03:04:39 -0400 Original-Received: from zimbra.cs.ucla.edu ([131.179.128.68]:47494) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i5loq-0007ML-IP; Thu, 05 Sep 2019 03:04:36 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 91BD7160062; Thu, 5 Sep 2019 00:04:34 -0700 (PDT) Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id OpiovN-5i5f7; Thu, 5 Sep 2019 00:04:33 -0700 (PDT) Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 340901600A9; Thu, 5 Sep 2019 00:04:33 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id E648yB0wnzTf; Thu, 5 Sep 2019 00:04:33 -0700 (PDT) Original-Received: from [192.168.1.9] (cpe-23-242-74-103.socal.res.rr.com [23.242.74.103]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id E55C4160062; Thu, 5 Sep 2019 00:04:32 -0700 (PDT) In-Reply-To: Content-Language: en-US X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 131.179.128.68 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:239863 Archived-At: This is a multi-part message in MIME format. --------------C379E03AD4D1065A567CE0C0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Stefan Monnier wrote: > I'm not sure if replacing INLINE with nothing at all would lead to much > worse code. I assume you meant "'static'" instead of "nothing at all" - we couldn't replace INLINE with nothing at all, as that would cause duplicate function definitions. I did try 'static' (actually, 'static ATTRIBUTE_UNUSED' to pacify gcc -Wunused-function) and found that it improved performance of 'make compile-always' by 8% on my old work desktop and by 6% on a newer machine, so I installed the attached patch. Using 'static' also shrank the text size of the executable by 4.5%, for what that's worth. 'static' also has the virtue of being simpler. At some point we can remove the EMACS_EXTERN_INLINE code as I expect it won't be needed. --------------C379E03AD4D1065A567CE0C0 Content-Type: text/x-patch; name="0001-Use-plain-static-for-Emacs-C-inline-functions.patch" Content-Disposition: attachment; filename="0001-Use-plain-static-for-Emacs-C-inline-functions.patch" Content-Transfer-Encoding: quoted-printable >From 365dad197bac5deec9244fd9c189d23c46c99b31 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 4 Sep 2019 23:13:54 -0700 Subject: [PATCH] =3D?UTF-8?q?Use=3D20plain=3D20=3DE2=3D80=3D98static=3DE2= =3D80=3D99=3D20for=3D20?=3D =3D?UTF-8?q?Emacs=3D20C=3D20inline=3D20functions?=3D MIME-Version: 1.0 Content-Type: text/plain; charset=3DUTF-8 Content-Transfer-Encoding: 8bit This improved performance of =E2=80=98make compile-always=E2=80=99 by 8.2= % on my platform (AMD Phenom II X4 910e, Fedora 30 x86-64). * src/conf_post.h (INLINE, EXTERN_INLINE, INLINE_HEADER_BEGIN) (INLINE_HEADER_END) [!EMACS_EXTERN_INLINE]: Use plain =E2=80=98static=E2=80= =99. --- src/conf_post.h | 43 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 34 insertions(+), 9 deletions(-) diff --git a/src/conf_post.h b/src/conf_post.h index 4af1ba9331..43f98620a4 100644 --- a/src/conf_post.h +++ b/src/conf_post.h @@ -373,8 +373,13 @@ #define ATTRIBUTE_MALLOC_SIZE(args) ATTRIBUTE_MALLOC= ATTRIBUTE_ALLOC_SIZE (args) #undef noinline #endif =20 -/* Use Gnulib's extern-inline module for extern inline functions. - An include file foo.h should prepend FOO_INLINE to function +/* INLINE marks functions defined in Emacs-internal C headers. + INLINE is implemented via C99-style 'extern inline' if Emacs is built + with -DEMACS_EXTERN_INLINE; otherwise it is implemented via 'static'. + EMACS_EXTERN_INLINE is no longer the default, as 'static' seems to + have better performance with GCC. + + An include file foo.h should prepend INLINE to function definitions, with the following overall pattern: =20 [#include any other .h files first.] @@ -399,20 +404,40 @@ #define ATTRIBUTE_MALLOC_SIZE(args) ATTRIBUTE_MALLO= C ATTRIBUTE_ALLOC_SIZE (args) For Emacs, this is done by having emacs.c first '#define INLINE EXTERN_INLINE' and then include every .h file that uses INLINE. =20 - The INLINE_HEADER_BEGIN and INLINE_HEADER_END suppress bogus - warnings in some GCC versions; see ../m4/extern-inline.m4. + The INLINE_HEADER_BEGIN and INLINE_HEADER_END macros suppress bogus + warnings in some GCC versions; see ../m4/extern-inline.m4. */ + +#ifdef EMACS_EXTERN_INLINE + +/* Use Gnulib's extern-inline module for extern inline functions. =20 C99 compilers compile functions like 'incr' as C99-style extern inline functions. Buggy GCC implementations do something similar wit= h GNU-specific keywords. Buggy non-GCC compilers use static functions, which bloats the code but is good enough. */ =20 -#ifndef INLINE -# define INLINE _GL_INLINE +# ifndef INLINE +# define INLINE _GL_INLINE +# endif +# define EXTERN_INLINE _GL_EXTERN_INLINE +# define INLINE_HEADER_BEGIN _GL_INLINE_HEADER_BEGIN +# define INLINE_HEADER_END _GL_INLINE_HEADER_END + +#else + +/* Use 'static' instead of 'extern inline' because 'static' typically + has better performance for Emacs. Do not use the 'inline' keyword, + as modern compilers inline automatically. ATTRIBUTE_UNUSED + pacifies gcc -Wunused-function. */ + +# ifndef INLINE +# define INLINE EXTERN_INLINE +# endif +# define EXTERN_INLINE static ATTRIBUTE_UNUSED +# define INLINE_HEADER_BEGIN +# define INLINE_HEADER_END + #endif -#define EXTERN_INLINE _GL_EXTERN_INLINE -#define INLINE_HEADER_BEGIN _GL_INLINE_HEADER_BEGIN -#define INLINE_HEADER_END _GL_INLINE_HEADER_END =20 /* 'int x UNINIT;' is equivalent to 'int x;', except it cajoles GCC into not warning incorrectly about use of an uninitialized variable. = */ --=20 2.17.1 --------------C379E03AD4D1065A567CE0C0--