[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Shrinking the C core
From: |
Emanuel Berg |
Subject: |
Re: Shrinking the C core |
Date: |
Thu, 10 Aug 2023 23:54:47 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Eli Zaretskii wrote:
> We are trying to make Lisp programs faster all the time,
> precisely because users do complain about annoying delays
> and slowness. Various optimizations in the byte-compiler and
> the whole native-compilation feature are parts of this
> effort
It's very fast with that, we should encourage more people do
use native-compilation.
>> If you take away nothing else from this conversation, at least get it
>> through your head that "more Lisp might make Emacs too slow" is a
>> deeply, *deeply* silly idea. It's 2023 and the only ways you can make
>> a user-facing program slow enough for response lag to be noticeable
>> are disk latency on spinning rust, network round-trips, or operations
>> with a superlinear big-O in critical paths. Mere interpretive overhead
>> won't do it.
>
> We found this conclusion to be false in practice, at least in Emacs
> practice.
In theory Lisp can be as fast as any other language but in
practice it is not the case with Elisp and Emacs at least.
Here is a n experiment with stats how Emacs/Elisp compares
to SBCL/CL, for this particular one it shows that Elisp, even
natively compiled, is still +78875% slower than Common Lisp.
;;; -*- lexical-binding: t -*-
;;
;; this file:
;; https://dataswamp.org/~incal/emacs-init/fib.el
;;
;; the CL:
;; https://dataswamp.org/~incal/cl/fib.cl
;;
;; code from:
;; elisp-benchmarks-1.14
;;
;; commands: [results]
;; $ emacs -Q -batch -l fib.el [8.660 s]
;; $ emacs -Q -batch -l fib.elc [3.386 s]
;; $ emacs -Q -batch -l fib-54a44480-bad305eb.eln [3.159 s]
;; $ sbcl -l fib.cl [0.004 s]
;;
;; (stats)
;; plain -> byte: +156%
;; plain -> native: +174%
;; plain -> sbcl: +216400%
;;
;; byte -> native: +7%
;; byte -> sbcl: +84550%
;;
;; native -> sbcl: +78875%
(require 'cl-lib)
(defun compare-table (l)
(cl-loop for (ni ti) in l
with first = t
do (setq first t)
(cl-loop for (nj tj) in l
do (when first
(insert "\n")
(setq first nil))
(unless (string= ni nj)
(let ((imp (* (- (/ ti tj) 1.0) 100)))
(when (< 0 imp)
(insert
(format ";; %s -> %s: %+.0f%%\n" ni nj imp) )))))))
(defun stats ()
(let ((p '("plain" 8.660))
(b '("byte" 3.386))
(n '("native" 3.159))
(s '("sbcl" 0.004)) )
(compare-table (list p b n s)) ))
(defun fib (reps num)
(let ((z 0))
(dotimes (_ reps)
(let ((p1 1)
(p2 1))
(dotimes (_ (- num 2))
(setf z (+ p1 p2)
p2 p1
p1 z))))
z))
(let ((beg (float-time)))
(fib 10000 1000)
(message "%.3f s" (- (float-time) beg)) )
;; (shell-command "emacs -Q -batch -l \"~/.emacs.d/emacs-init/fib.el\"")
;; (shell-command "emacs -Q -batch -l \"~/.emacs.d/emacs-init/fib.elc\"")
;; (shell-command "emacs -Q -batch -l
\"~/.emacs.d/eln-cache/30.0.50-3b889b4a/fib-54a44480-8bbda87b.eln\"")
(provide 'fib)
--
underground experts united
https://dataswamp.org/~incal
- Re: Shrinking the C core, (continued)
- Re: Shrinking the C core, Eli Zaretskii, 2023/08/10
- Re: Shrinking the C core, Eric S. Raymond, 2023/08/10
- Re: Shrinking the C core, Christopher Dimech, 2023/08/10
- Re: Shrinking the C core, Immanuel Litzroth, 2023/08/11
- Re: Shrinking the C core, Eli Zaretskii, 2023/08/11
- Re: Shrinking the C core, tomas, 2023/08/11
- Re: Shrinking the C core, Eli Zaretskii, 2023/08/11
- Re: Shrinking the C core,
Emanuel Berg <=
- Bignum performance (was: Shrinking the C core), Ihor Radchenko, 2023/08/11
- Re: Bignum performance (was: Shrinking the C core), Emanuel Berg, 2023/08/11
- Re: Bignum performance (was: Shrinking the C core), Ihor Radchenko, 2023/08/11
- Re: Bignum performance (was: Shrinking the C core), Emanuel Berg, 2023/08/11
- [PATCH] Re: Bignum performance (was: Shrinking the C core), Ihor Radchenko, 2023/08/11
- Re: [PATCH] Re: Bignum performance (was: Shrinking the C core), Emanuel Berg, 2023/08/11
- Re: [PATCH] Re: Bignum performance (was: Shrinking the C core), Ihor Radchenko, 2023/08/11
- Re: [PATCH] Re: Bignum performance (was: Shrinking the C core), Emanuel Berg, 2023/08/12
- Re: [PATCH] Re: Bignum performance (was: Shrinking the C core), Ihor Radchenko, 2023/08/12
- Re: [PATCH] Re: Bignum performance (was: Shrinking the C core), Emanuel Berg, 2023/08/12