]> git.eshelyaron.com Git - emacs.git/commitdiff
XSYMBOL eassume speedups
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 13 Feb 2024 17:54:51 +0000 (09:54 -0800)
committerEshel Yaron <me@eshelyaron.com>
Wed, 14 Feb 2024 08:16:21 +0000 (09:16 +0100)
* src/lisp.h (XSYMBOL_WITH_POS_SYM, XSYMBOL): Help the compiler by using
eassume instead of eassert for XSYMBOL postconditions likely to be
useful for optimization later.  With gcc 13.2 -O2 x86-64 this improved
speed on my usual “compile all .el files” benchmark by 0.7% and shrank
the text size of Emacs by 0.09%.

(cherry picked from commit d202f1b9e74107c0e51c5d2fdbe094cbe1baaadb)

src/lisp.h

index e9b0bd522af5772d99ba01d847a795a7ba9bcf65..bf96bfd39f7d6810ae9bfd1c0a4c09a8e06680c2 100644 (file)
@@ -1117,7 +1117,7 @@ INLINE Lisp_Object
 XSYMBOL_WITH_POS_SYM (Lisp_Object a)
 {
   Lisp_Object sym = XSYMBOL_WITH_POS (a)->sym;
-  eassert (BARE_SYMBOL_P (sym));
+  eassume (BARE_SYMBOL_P (sym));
   return sym;
 }
 
@@ -1148,7 +1148,7 @@ XSYMBOL (Lisp_Object a)
 {
   if (!BARE_SYMBOL_P (a))
     {
-      eassert (symbols_with_pos_enabled);
+      eassume (symbols_with_pos_enabled);
       a = XSYMBOL_WITH_POS_SYM (a);
     }
   return XBARE_SYMBOL (a);