mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-03-06 14:02:07 -08:00
Improve inlining when compiling with -Og
* src/conf_post.h (EXTERN_INLINE) [!EMACS_EXTERN_INLINE]: Make it static inline, not merely static. This is a worthwhile performance improvement on my two platforms A and B (see below). On my platform A this change improves user+system CPU performance of ‘make compile-always’ by 52% on an -Og build, and by 1.4% on the default -O2 build. On my platform B this improves the same benchmark by 41% on an -Og build, and by -0.8% on the default -O2 build. That "-0.8%" is a small negative for this change, and I recall that it is why I didn't make this change earlier. However, Platform B uses an older GCC so we needn't worry overmuch about this small negative. With this change the performance advantage of -O2 over -Og has dropped on platform A; formerly -O2 was 87% faster than -Og, and now it is only 25% faster. On platform B the performance advantage of -O2 over -Og has dropped from being 62% faster to being 14% faster. Platform A is GCC 9.3.1 20200317 (Red Hat 9.3.1-1) on Fedora 31 x86-64 (AMD Phenom II X4 910e, circa 2010). Platform B is GCC (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 on Ubuntu 18.04.4 (Intel Xeon E3-1225 V2, circa 2012). This patch was inspired by a suggestion by Andrea Corallo in: https://lists.gnu.org/r/emacs-devel/2020-04/msg00263.html
This commit is contained in:
parent
6382e13308
commit
b9b32074ce
1 changed files with 3 additions and 5 deletions
|
|
@ -432,15 +432,13 @@ extern int emacs_setenv_TZ (char const *);
|
|||
|
||||
#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. */
|
||||
/* Use 'static inline' instead of 'extern inline' because 'static inline'
|
||||
has much better performance for Emacs when compiled with 'gcc -Og'. */
|
||||
|
||||
# ifndef INLINE
|
||||
# define INLINE EXTERN_INLINE
|
||||
# endif
|
||||
# define EXTERN_INLINE static ATTRIBUTE_UNUSED
|
||||
# define EXTERN_INLINE static inline
|
||||
# define INLINE_HEADER_BEGIN
|
||||
# define INLINE_HEADER_END
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue