]> git.eshelyaron.com Git - emacs.git/commit
Simplify and speed up numeric comparisons
authorMattias EngdegÄrd <mattiase@acm.org>
Sat, 20 Jul 2024 11:12:19 +0000 (13:12 +0200)
committerEshel Yaron <me@eshelyaron.com>
Sat, 27 Jul 2024 16:24:02 +0000 (18:24 +0200)
commit82365f9408461fd471a79902745c204e4af9fced
treec5157ddbac902ee2c669b6bc8f411906e172e126
parent4b05f146f0074816faf7c1e41a3f3dccefd6edd0
Simplify and speed up numeric comparisons

This makes comparison functions (=, /=, <, <=, >, >=, min, max) quite
a bit faster (10-20 %).  Bytecode ops on fixnums are not affected,
nor is `value<`.

* src/data.c (arithcompare): Simplify the code to reduce the number of
branches.  Remove the comparison code argument; instead, return the
relation encoded as bits, which can be tested cheaply.  All callers
adapted.
* src/lisp.h (enum Arith_Comparison): Remove.
(Cmp_Bit_*, cmp_bits_t): New.

(cherry picked from commit 2fd38e5c496a2351a25e95df37a7900f6f80f22f)
src/bytecode.c
src/data.c
src/fileio.c
src/lisp.h