Exploring Speculative JIT Compilation for Emacs Lisp with Java

https://news.ycombinator.com/rss Hits: 5
Summary

Let’s look at some more benchmarks. Figure 8: Results of two more benchmarks For example, for the inclist/inclist-type-hints benchmarks (the green columns above, namely, increment-elements-in-list), Juicemacs is really slow. This comes partly from the cost of Java “boxing” integers – it has to allocate for every incremented integer, while Emacs nativecomp, with tagged values, does not. On the other hand, for this particular benchmark, Emacs nativecomp actually has fast paths for all of the operations . That’s why it can be so fast, and that also proves that, compared to the Fibonacci benchmarks, nativecomp has a lot of potential for improvement if it gets more fast paths. nativecomp Juicemacs advice Glue not native-compiled JIT-capable inclist All operations on fast path Java integer boxing costs There is another benchmark here that uses advices—Emacs Lisp supports using advices to override functions by wrapping the original function and an advice function inside a glue function: ;; The "glue" functions defined in nadvice.el, where ;; "car" is the advice and "cdr" is the original. (defvar advice--how-alist (advice--make-how-alist (:around (apply car cdr r)) (:before (apply car r) (apply cdr r)) (:after (prog1 (apply cdr r) (apply car r))) (:override (apply car r)) (:after-until (or (apply cdr r) (apply car r))) (:after-while (and (apply cdr r) (apply car r))) (:before-until (or (apply car r) (apply cdr r))) (:before-while (and (apply car r) (apply cdr r))) (:filter-args (apply cdr (funcall car r))) (:filter-return (funcall car (apply cdr r))))) In this benchmark, we advise the Fibonacci function to cache the first ten entries to speed up computation, as can be seen in the speed-up in the Juicemacs results. However, it seems that nativecomp does not yet compile glue functions (as of GNU Emacs 30), which makes advices slower. (define-advice elb-fibn-rec-adviced (:before-until (n) elb-fibn-lookup-table-advice) (and (< n 10) (aref [0 1 1 2 3 5 8 13 21 34] n))) Every (in...

First seen: 2025-12-22 05:33

Last seen: 2025-12-22 09:34