aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2024-02-13 09:54:50 -0800
committerPaul Eggert2024-02-13 11:20:32 -0800
commitd2a5d7534c7dcdc4432bf5456cb8a76680f7aa14 (patch)
tree33c70f9f643669f7337b6c6db0e75f098c254b74
parentd61145cc8cfb31ca170cd1b5deab59f0a5cbea63 (diff)
downloademacs-d2a5d7534c7dcdc4432bf5456cb8a76680f7aa14.tar.gz
emacs-d2a5d7534c7dcdc4432bf5456cb8a76680f7aa14.zip
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%.
-rw-r--r--src/lisp.h26
1 files 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;
384 ((ok) ? (void) 0 : wrong_type_argument (predicate, x)) 384 ((ok) ? (void) 0 : wrong_type_argument (predicate, x))
385#define lisp_h_CONSP(x) TAGGEDP (x, Lisp_Cons) 385#define lisp_h_CONSP(x) TAGGEDP (x, Lisp_Cons)
386#define lisp_h_BASE_EQ(x, y) (XLI (x) == XLI (y)) 386#define lisp_h_BASE_EQ(x, y) (XLI (x) == XLI (y))
387#define lisp_h_BASE2_EQ(x, y) \ 387#define lisp_h_BASE2_EQ(x, y) \
388 (BASE_EQ (x, y) \ 388 (symbols_with_pos_enabled \
389 || (symbols_with_pos_enabled \ 389 ? BASE_EQ (SYMBOL_WITH_POS_P (x) ? XSYMBOL_WITH_POS (x)->sym : (x), y) \
390 && SYMBOL_WITH_POS_P (x) \ 390 : BASE_EQ (x, y))
391 && BASE_EQ (XSYMBOL_WITH_POS (x)->sym, y)))
392 391
393/* FIXME: Do we really need to inline the whole thing? 392/* FIXME: Do we really need to inline the whole thing?
394 * What about keeping the part after `symbols_with_pos_enabled` in 393 * What about keeping the part after `symbols_with_pos_enabled` in
395 * a separate function? */ 394 * a separate function? */
396#define lisp_h_EQ(x, y) \ 395#define lisp_h_EQ(x, y) \
397 (XLI (x) == XLI (y) \ 396 (symbols_with_pos_enabled \
398 || (symbols_with_pos_enabled \ 397 ? BASE_EQ (SYMBOL_WITH_POS_P (x) ? XSYMBOL_WITH_POS (x)->sym : (x), \
399 && (SYMBOL_WITH_POS_P (x) \ 398 SYMBOL_WITH_POS_P (y) ? XSYMBOL_WITH_POS (y)->sym : (y)) \
400 ? (BARE_SYMBOL_P (y) \ 399 : BASE_EQ (x, y))
401 ? XLI (XSYMBOL_WITH_POS (x)->sym) == XLI (y) \
402 : (SYMBOL_WITH_POS_P (y) \
403 && (XLI (XSYMBOL_WITH_POS (x)->sym) \
404 == XLI (XSYMBOL_WITH_POS (y)->sym)))) \
405 : (SYMBOL_WITH_POS_P (y) \
406 && BARE_SYMBOL_P (x) \
407 && (XLI (x) == XLI (XSYMBOL_WITH_POS (y)->sym))))))
408 400
409#define lisp_h_FIXNUMP(x) \ 401#define lisp_h_FIXNUMP(x) \
410 (! (((unsigned) (XLI (x) >> (USE_LSB_TAG ? 0 : FIXNUM_BITS)) \ 402 (! (((unsigned) (XLI (x) >> (USE_LSB_TAG ? 0 : FIXNUM_BITS)) \