summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/comp-cstr.el
diff options
context:
space:
mode:
authorMattias Engdegård <mattiase@acm.org>2023-01-28 16:26:37 +0100
committerMattias Engdegård <mattiase@acm.org>2023-01-29 12:02:57 +0100
commite55855c5a1e85e230d2860c973358a34eb72da64 (patch)
tree2462fb6f48e97903caffa991037792975aa69cf5 /lisp/emacs-lisp/comp-cstr.el
parente2b37f901d16d8e621d2adfed84f46a21a3716ab (diff)
downloademacs-e55855c5a1e85e230d2860c973358a34eb72da64.tar.gz
emacs-e55855c5a1e85e230d2860c973358a34eb72da64.tar.bz2
emacs-e55855c5a1e85e230d2860c973358a34eb72da64.zip
Better compilation of n-ary comparisons
Transform n-ary comparisons to a chain of binary comparisons in the Lisp optimiser instead of in codegen, to allow for subsequent optimisations. This generalises the transform, so that (< 1 X 10) -> (let ((x X)) (and (< 1 x) (< x 10))) where (< 1 x) is then flipped to (> x 1) in codegen since it's slightly more efficient to have the constant argument last. Arguments that are neither constants nor variables are given temporary bindings. This results in about 2× speedup for 3-ary comparisons of fixnums with nontrivial arguments, and also improves the code slightly for binary comparisons with a constant first argument. * lisp/emacs-lisp/byte-opt.el (byte-opt--nary-comparison): New, set as the `byte-optimizer` property for =, <, <=, >, and >=. * lisp/emacs-lisp/bytecomp.el (byte-compile-and-folded): Rename to... (byte-compile-cmp): ...and rewrite.
Diffstat (limited to 'lisp/emacs-lisp/comp-cstr.el')
0 files changed, 0 insertions, 0 deletions