From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Emanuel Berg Newsgroups: gmane.emacs.devel Subject: Re: Shrinking the C core Date: Thu, 10 Aug 2023 23:54:47 +0200 Message-ID: <87jzu2tvfc.fsf@dataswamp.org> References: <20230809094655.793FC18A4654@snark.thyrsus.com> <87il9owg0f.fsf@yahoo.com> <83fs4rjq9j.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8515"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) To: emacs-devel@gnu.org Cancel-Lock: sha1:0qxDDe/oyyCpo9uyHTSwEl0GE0o= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Aug 11 07:33:08 2023 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qUKln-0001uT-2S for ged-emacs-devel@m.gmane-mx.org; Fri, 11 Aug 2023 07:33:07 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qUKl9-0003OB-Be; Fri, 11 Aug 2023 01:32:27 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qUDcV-0000Rw-Uc for emacs-devel@gnu.org; Thu, 10 Aug 2023 17:55:03 -0400 Original-Received: from ciao.gmane.io ([116.202.254.214]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qUDcR-0004Ug-7k for emacs-devel@gnu.org; Thu, 10 Aug 2023 17:55:03 -0400 Original-Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1qUDcM-0004Ft-Li for emacs-devel@gnu.org; Thu, 10 Aug 2023 23:54:55 +0200 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: emacs-devel@gnu.org Mail-Copies-To: never Received-SPF: pass client-ip=116.202.254.214; envelope-from=ged-emacs-devel@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.249, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Fri, 11 Aug 2023 01:32:18 -0400 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:308553 Archived-At: 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