diff options
| author | Paul Eggert | 2025-12-19 09:09:16 -0800 |
|---|---|---|
| committer | Paul Eggert | 2025-12-19 09:10:31 -0800 |
| commit | 4d11449c96c80e2ea402c88fe637958b8c0cf940 (patch) | |
| tree | bb82b10e60078128623a9f33e4dbdbfb0bea932d | |
| parent | a6c2ae3a3fb89cd0eedd1b6b4e81fb90ce910f96 (diff) | |
| download | emacs-4d11449c96c80e2ea402c88fe637958b8c0cf940.tar.gz emacs-4d11449c96c80e2ea402c88fe637958b8c0cf940.zip | |
Revert to simpler (and we hope faster) TAGGEDP
Suggested by Mattias Engdegård (bug#80021#17).
* src/lisp.h (lisp_h_FIXNUMP, lisp_h_TAGGEDP):
Go back to the simpler (X&7) == TAG approach for checking object tags.
This reverses my commit ccdb08ef4ed8f96e79aa06cf5e806c9c487d58ad
“Improve performance of CONSP, FIXNUMP, etc.”
dated 2018-08-25 13:39:18 -0700,
though it keeps the TAGGEDP function the older commit introduced.
Although the older commit improved performance on its circa 2010
platform, when I ran today’s ‘make -C lisp compile-always’
benchmark on Ubuntu 25.10 which uses gcc (Ubuntu 15.2.0-4ubuntu4)
on an circa-2021 Intel Xeon W-1350, this patch makes the
‘make -C lisp compile-always’ benchmark 3.1% faster. Although the
patch unfortunately also makes the Emacs text segment 0.6% larger,
in this case speed and simplicity beat text size in importance.
| -rw-r--r-- | src/lisp.h | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/src/lisp.h b/src/lisp.h index 968ea4c4086..f278bd32110 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -394,10 +394,7 @@ typedef EMACS_INT Lisp_Word; | |||
| 394 | #define lisp_h_CONSP(x) TAGGEDP (x, Lisp_Cons) | 394 | #define lisp_h_CONSP(x) TAGGEDP (x, Lisp_Cons) |
| 395 | #define lisp_h_BASE_EQ(x, y) (XLI (x) == XLI (y)) | 395 | #define lisp_h_BASE_EQ(x, y) (XLI (x) == XLI (y)) |
| 396 | 396 | ||
| 397 | #define lisp_h_FIXNUMP(x) \ | 397 | #define lisp_h_FIXNUMP(x) ((XTYPE (x) & (Lisp_Int0 | ~Lisp_Int1)) == Lisp_Int0) |
| 398 | (! (((unsigned) (XLI (x) >> (USE_LSB_TAG ? 0 : FIXNUM_BITS)) \ | ||
| 399 | - (unsigned) (Lisp_Int0 >> !USE_LSB_TAG)) \ | ||
| 400 | & ((1 << INTTYPEBITS) - 1))) | ||
| 401 | #define lisp_h_FLOATP(x) TAGGEDP (x, Lisp_Float) | 398 | #define lisp_h_FLOATP(x) TAGGEDP (x, Lisp_Float) |
| 402 | #define lisp_h_NILP(x) BASE_EQ (x, Qnil) | 399 | #define lisp_h_NILP(x) BASE_EQ (x, Qnil) |
| 403 | #define lisp_h_SYMBOL_CONSTANT_P(sym) \ | 400 | #define lisp_h_SYMBOL_CONSTANT_P(sym) \ |
| @@ -405,10 +402,7 @@ typedef EMACS_INT Lisp_Word; | |||
| 405 | #define lisp_h_SYMBOL_TRAPPED_WRITE_P(sym) (XSYMBOL (sym)->u.s.trapped_write) | 402 | #define lisp_h_SYMBOL_TRAPPED_WRITE_P(sym) (XSYMBOL (sym)->u.s.trapped_write) |
| 406 | #define lisp_h_SYMBOL_WITH_POS_P(x) PSEUDOVECTORP (x, PVEC_SYMBOL_WITH_POS) | 403 | #define lisp_h_SYMBOL_WITH_POS_P(x) PSEUDOVECTORP (x, PVEC_SYMBOL_WITH_POS) |
| 407 | #define lisp_h_BARE_SYMBOL_P(x) TAGGEDP (x, Lisp_Symbol) | 404 | #define lisp_h_BARE_SYMBOL_P(x) TAGGEDP (x, Lisp_Symbol) |
| 408 | #define lisp_h_TAGGEDP(a, tag) \ | 405 | #define lisp_h_TAGGEDP(a, tag) (XTYPE (a) == (tag)) |
| 409 | (! (((unsigned) (XLI (a) >> (USE_LSB_TAG ? 0 : VALBITS)) \ | ||
| 410 | - (unsigned) (tag)) \ | ||
| 411 | & ((1 << GCTYPEBITS) - 1))) | ||
| 412 | #define lisp_h_VECTORLIKEP(x) TAGGEDP (x, Lisp_Vectorlike) | 406 | #define lisp_h_VECTORLIKEP(x) TAGGEDP (x, Lisp_Vectorlike) |
| 413 | #define lisp_h_XCAR(c) XCONS (c)->u.s.car | 407 | #define lisp_h_XCAR(c) XCONS (c)->u.s.car |
| 414 | #define lisp_h_XCDR(c) XCONS (c)->u.s.u.cdr | 408 | #define lisp_h_XCDR(c) XCONS (c)->u.s.u.cdr |