]> git.eshelyaron.com Git - emacs.git/commit
Optimize calls to 'eql', 'memql' and similar for fixnums.
authorPhilipp Stephani <phst@google.com>
Thu, 6 May 2021 17:13:00 +0000 (19:13 +0200)
committerPhilipp Stephani <phst@google.com>
Sun, 16 May 2021 12:45:18 +0000 (14:45 +0200)
commit01bd4d1a824816fba34571623a65c9c1541c27e5
tree667d32d06222d17015b3b2689b310f94c1fb21c8
parent4f510f63a8fc3483eeac7887cb69ddfa6de9b5a6
Optimize calls to 'eql', 'memql' and similar for fixnums.

It's good practice to compare integers using 'eql' because two bignum
objects representing the same integer might not be 'eq'.  However,
'eql' is slower and doesn't have its own byte code.  Therefore,
replace it with 'eq' if one argument is guaranteed to be a fixnum on
all platforms.

* lisp/emacs-lisp/byte-opt.el (byte-optimize--fixnump): New helper
function.
(byte-optimize-equal, byte-optimize-member, byte-optimize-assoc): Use
it to optimize 'eql' etc. to 'eq' if it will always compare fixnums.
lisp/emacs-lisp/byte-opt.el