unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Emanuel Berg <incal@dataswamp.org>
To: help-gnu-emacs@gnu.org
Subject: stats say SBCL is 78 875 % faster than natively compiled Elisp
Date: Tue, 14 Feb 2023 08:56:04 +0100	[thread overview]
Message-ID: <87bklw7ka3.fsf@dataswamp.org> (raw)

;;; -*- 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




             reply	other threads:[~2023-02-14  7:56 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-14  7:56 Emanuel Berg [this message]
2023-02-15  5:04 ` stats say SBCL is 78 875 % faster than natively compiled Elisp Chen Zhaoyang
2023-02-15 11:37   ` Emanuel Berg
2023-02-15  6:59 ` Jean Louis
2023-02-16  6:04   ` Emanuel Berg
2023-02-17 17:38     ` Jean Louis
2023-02-18 19:54       ` Emanuel Berg
2023-02-18 20:15         ` Emanuel Berg
2023-02-18 20:39           ` Eli Zaretskii
2023-02-18 20:47             ` Emanuel Berg
2023-02-19  6:35               ` Eli Zaretskii
2023-02-21  7:04                 ` Native compilation by default?: Was [Re: " Madhu
2023-02-21 12:37                   ` Eli Zaretskii
2023-02-21 16:35                     ` Emanuel Berg
2023-02-21 19:57                       ` Emanuel Berg
2023-02-21 22:21                       ` Native compilation by default? (was: Re: stats say SBCL is 78 875 % faster than natively compiled Elisp) Emanuel Berg
2023-02-21 23:54                         ` Emanuel Berg
     [not found]                           ` <87h6vetquk.fsf@dataswamp.org>
2023-02-22  1:47                             ` Emanuel Berg
2023-02-23 10:46                         ` Emanuel Berg
2023-02-23 20:18                           ` Jean Louis
2023-02-26  1:05                             ` Emanuel Berg
2023-02-22 12:32                       ` Native compilation by default?: Was [Re: stats say SBCL is 78 875 % faster than natively compiled Elisp Eli Zaretskii
2023-02-26  3:08                     ` Madhu
2023-02-26  4:32                       ` Stefan Monnier via Users list for the GNU Emacs text editor
2023-02-26  5:15                         ` Emanuel Berg
2023-02-26  6:27                         ` Eli Zaretskii
2023-02-26  7:10                         ` Emanuel Berg
2023-02-26 16:14                         ` FW: [External] : " Drew Adams
2023-02-26 16:31                           ` Eli Zaretskii
2023-02-26 17:12                             ` Drew Adams
2023-02-26 17:31                               ` Eli Zaretskii
2023-02-26 18:29                                 ` Drew Adams
2023-02-26 19:04                                   ` Eli Zaretskii
2023-02-26 20:05                                     ` Emanuel Berg
2023-02-27  8:42                         ` Madhu
2023-03-03 14:55                           ` Stefan Monnier via Users list for the GNU Emacs text editor
2023-02-26  6:25                       ` Eli Zaretskii
2023-02-26 16:10                         ` [External] : " Drew Adams
2023-02-19  5:58         ` Jean Louis
2023-02-15 12:36 ` full native compile (was: Re: stats say SBCL is 78 875 % faster than natively compiled Elisp) Emanuel Berg
2023-02-15 14:05   ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bklw7ka3.fsf@dataswamp.org \
    --to=incal@dataswamp.org \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).