emacs-diffs
[Top][All Lists]
Advanced

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

master d2a5d7534c7 1/8: Simplify and speed up EQ


From: Paul Eggert
Subject: master d2a5d7534c7 1/8: Simplify and speed up EQ
Date: Tue, 13 Feb 2024 14:20:42 -0500 (EST)

branch: master
commit d2a5d7534c7dcdc4432bf5456cb8a76680f7aa14
Author: Paul Eggert <eggert@cs.ucla.edu>
Commit: Paul Eggert <eggert@cs.ucla.edu>

    Simplify and speed up EQ
    
    * src/lisp.h (lisp_h_BASE2_EQ, lisp_h_EQ):
    Simplify by testing symbols_with_pos_enabled first.
    On x86-64 with GCC 13.2 this shrinks temacs text by 1.5%
    and after removing all *.elc files speeds up 'make' by 1.2%.
---
 src/lisp.h | 26 +++++++++-----------------
 1 file changed, 9 insertions(+), 17 deletions(-)

diff --git a/src/lisp.h b/src/lisp.h
index 5326824bf38..f6133669ac1 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -384,27 +384,19 @@ typedef EMACS_INT Lisp_Word;
    ((ok) ? (void) 0 : wrong_type_argument (predicate, x))
 #define lisp_h_CONSP(x) TAGGEDP (x, Lisp_Cons)
 #define lisp_h_BASE_EQ(x, y) (XLI (x) == XLI (y))
-#define lisp_h_BASE2_EQ(x, y)                              \
-  (BASE_EQ (x, y)                                          \
-   || (symbols_with_pos_enabled                                    \
-       && SYMBOL_WITH_POS_P (x)                                    \
-       && BASE_EQ (XSYMBOL_WITH_POS (x)->sym, y)))
+#define lisp_h_BASE2_EQ(x, y) \
+  (symbols_with_pos_enabled \
+   ? BASE_EQ (SYMBOL_WITH_POS_P (x) ? XSYMBOL_WITH_POS (x)->sym : (x), y) \
+   : BASE_EQ (x, y))
 
 /* FIXME: Do we really need to inline the whole thing?
  * What about keeping the part after `symbols_with_pos_enabled` in
  * a separate function?  */
-#define lisp_h_EQ(x, y)                                     \
-  (XLI (x) == XLI (y)                                      \
-   || (symbols_with_pos_enabled                             \
-       && (SYMBOL_WITH_POS_P (x)                           \
-           ? (BARE_SYMBOL_P (y)                                    \
-              ? XLI (XSYMBOL_WITH_POS (x)->sym) == XLI (y)  \
-              : (SYMBOL_WITH_POS_P (y)                     \
-                && (XLI (XSYMBOL_WITH_POS (x)->sym)        \
-                    == XLI (XSYMBOL_WITH_POS (y)->sym))))  \
-           : (SYMBOL_WITH_POS_P (y)                        \
-              && BARE_SYMBOL_P (x)                         \
-              && (XLI (x) == XLI (XSYMBOL_WITH_POS (y)->sym))))))
+#define lisp_h_EQ(x, y) \
+  (symbols_with_pos_enabled \
+   ? BASE_EQ (SYMBOL_WITH_POS_P (x) ? XSYMBOL_WITH_POS (x)->sym : (x), \
+             SYMBOL_WITH_POS_P (y) ? XSYMBOL_WITH_POS (y)->sym : (y)) \
+   : BASE_EQ (x, y))
 
 #define lisp_h_FIXNUMP(x) \
    (! (((unsigned) (XLI (x) >> (USE_LSB_TAG ? 0 : FIXNUM_BITS)) \



reply via email to

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