]> git.eshelyaron.com Git - emacs.git/commitdiff
* src/lisp.h (EQ): Improve generated code.
authorAndrea Corallo <acorallo@gnu.org>
Wed, 27 Nov 2024 13:18:24 +0000 (14:18 +0100)
committerEshel Yaron <me@eshelyaron.com>
Wed, 4 Dec 2024 16:59:35 +0000 (17:59 +0100)
Outside compilation 'symbols_with_pos_enabled' is always false, so ask
the compiler to organize the most likely execution path in a sequential
fashion in order to favor run-time performance.

(cherry picked from commit b0ba0d42b0fdf70a20cd7a070128db8abe4a0826)

src/lisp.h

index 5ef97047f76559ff0badfd5d44e6809f10d5c528..832a1755c047897dc07c9e151da724bc1bcc4f7b 100644 (file)
@@ -1353,10 +1353,10 @@ INLINE bool
 INLINE bool
 EQ (Lisp_Object x, Lisp_Object y)
 {
-  return BASE_EQ ((symbols_with_pos_enabled && SYMBOL_WITH_POS_P (x)
-                  ? XSYMBOL_WITH_POS_SYM (x) : x),
-                 (symbols_with_pos_enabled && SYMBOL_WITH_POS_P (y)
-                  ? XSYMBOL_WITH_POS_SYM (y) : y));
+  return BASE_EQ ((__builtin_expect (symbols_with_pos_enabled, false)
+                  && SYMBOL_WITH_POS_P (x) ? XSYMBOL_WITH_POS_SYM (x) : x),
+                 (__builtin_expect (symbols_with_pos_enabled, false)
+                  && SYMBOL_WITH_POS_P (y) ? XSYMBOL_WITH_POS_SYM (y) : y));
 }
 
 INLINE intmax_t