bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: avoiding 'static inline'


From: Simon Josefsson
Subject: Re: avoiding 'static inline'
Date: Sun, 19 Aug 2012 09:17:54 +0200
User-agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/23.3 (gnu/linux)

Paul Eggert <address@hidden> writes:

> I recently added a bunch of static inline functions to Emacs,
> and just for fun I tried changing them to plain 'static' to
> see how much that would hurt performance.  To my surprise, it
> made Emacs 14% faster on my standard Lisp benchmark (taking the nth
> element of a long list).  It also shrank the size of the text segment
> by 1.7%, which was not as much of a surprise.
>
> Clearly I've been using 'static inline' too much.  Come to think of
> it, these days there's little need for 'static inline' as opposed to
> 'static', since GCC and other modern compilers will inline 'static'
> functions for you.  And apparently they do a better job if they're not
> given bad advice by people who use the 'inline' keyword.
>
> I'd like to install some changes to gnulib, so that its code does
> not use 'static inline' in the modules that Emacs uses.  This is part
> of a similar, larger change to Emacs proper.  These patches won't
> affect extern inline functions, just static ones.
>
> There are more opportunities for changes like this to gnulib, but
> I thought I'd do these first and ask for comments.

+1

I have always found inline to be a waste of maintainer time due to all
portability issues.  If performance is critical, you are usually better
of moving to hand-written assembler with a fall-back to a portable C
implementation.

/Simon



reply via email to

[Prev in Thread] Current Thread [Next in Thread]