summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/bytecomp.el
diff options
context:
space:
mode:
authorVibhav Pant <vibhavp@gmail.com>2017-02-09 12:18:54 +0530
committerVibhav Pant <vibhavp@gmail.com>2017-02-09 12:18:54 +0530
commitdde800c8c9ea198996229d03df1fc45c7d057339 (patch)
tree5101a2f8260e141a64af96e84ca565dd8e49a568 /lisp/emacs-lisp/bytecomp.el
parent96c4e367f973626cbab38af55a2c448b7274eeee (diff)
downloademacs-dde800c8c9ea198996229d03df1fc45c7d057339.tar.gz
emacs-dde800c8c9ea198996229d03df1fc45c7d057339.tar.bz2
emacs-dde800c8c9ea198996229d03df1fc45c7d057339.zip
Improve byte-switch execution.
* lisp/emacs-lisp/byte-opt.el, lisp/emacs-lisp/bytecomp.el (byte-decompile-bytecode-1), (byte-compile-lapcode): Calculate the actual jump address while compiling, store it in the jump table. * src/bytecode.c: Jump to the looked up value directly, do a linear search when the number of elements is <= 5.
Diffstat (limited to 'lisp/emacs-lisp/bytecomp.el')
-rw-r--r--lisp/emacs-lisp/bytecomp.el9
1 files changed, 5 insertions, 4 deletions
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index d5a163e5fdd..748a8cd01f3 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -917,10 +917,11 @@ CONST2 may be evaluated multiple times."
(if (> (car bytes-tail) 255) (error "Bytecode overflow")))
(dolist (hash-table byte-compile-jump-tables)
- (cl-loop for k being the hash-keys of hash-table do
- (let ((tag (cdr (gethash k hash-table))))
- (setq pc (car tag))
- (puthash k (cons (logand pc 255) (lsh pc -8)) hash-table))))
+ (maphash #'(lambda (value tag)
+ (setq pc (cadr tag))
+ (puthash value (+ (logand pc 255) (lsh (lsh pc -8) 8))
+ hash-table))
+ hash-table))
(apply 'unibyte-string (nreverse bytes))))