1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 14:30:50 -08:00

Faster constant pool string searching

* lisp/emacs-lisp/bytecomp.el (byte-compile-get-constant):
No reason not to use 'assoc' to search for strings as well.
Previously we kept searching even after having found the string!
This commit is contained in:
Mattias Engdegård 2025-10-29 16:06:30 +01:00
parent 305744fdfc
commit 676ee88eea

View file

@ -3870,14 +3870,8 @@ assignment (i.e. `setq')."
(byte-compile-dynamic-variable-op 'byte-varset var))))
(defmacro byte-compile-get-constant (const)
`(or (if (stringp ,const)
;; In a string constant, treat properties as significant.
(let (result)
(dolist (elt byte-compile-constants)
(if (equal-including-properties (car elt) ,const)
(setq result elt)))
result)
(assoc ,const byte-compile-constants #'eql))
`(or (assoc ,const byte-compile-constants
(if (stringp ,const) #'equal-including-properties #'eql))
(car (setq byte-compile-constants
(cons (list ,const) byte-compile-constants)))))