all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Arthur Miller <arthur.miller@live.com>
To: yantar92@posteo.net
Cc: robertstephenboyer@gmail.com, emacs-devel@gnu.org
Subject: Re: Some thoughts about Emacs performance
Date: Fri, 09 Feb 2024 00:53:02 +0100	[thread overview]
Message-ID: <DU2PR02MB10109DA2BC5ACABE9BCAF5A7696442@DU2PR02MB10109.eurprd02.prod.outlook.com> (raw)

>Robert Boyer <robertstephenboyer@gmail.com> writes:
>
>> Emacs 27.1 has a 'sort' function that takes longer than stable-sort of
>> SBCL. Maybe
>> by a factor of 2. See also my attached file 'ms.lisp'.
>>
>> There may be a lot that can be improved in Emacs'
>> handling of cl-loop, setf, elt, or cl-random.
>
>When comparing Elisp and SBCL, it is more fair to compare
>native-compiler Elisp rather than byte-compiled.
>Then, both codes are compiled to machine code.

The sort is implemented in C, so it does not matter so much, but I did compiled
to native with comp-speed 3, and I have replaced cl-random (lisp) call with call
to random (C).

What I have seen was that on first few runs, sbcl was faster.

Definitely not as a drammatic difference as in Robert's test,
but SBCL was still somewhat faster:

Emacs:

(benchmark 1 '(setq foo (make-random-array (expt 10 n))))
Elapsed time: 0.097354s (0.053204s in 1 GCs)

(benchmark 1 '(sort foo '<))
Elapsed time: 0.271281s

SBCL:
CL-USER> (time (defparameter foo (make-random-array (expt 10 n))))

Evaluation took:
  0.020 seconds of real time
  0.015625 seconds of total run time (0.000000 user, 0.015625 system)
  80.00% CPU
  50,840,363 processor cycles
  8,000,016 bytes consed
  

CL-USER> (time (progn (stable-sort foo '<) nil))

Evaluation took:
  0.165 seconds of real time
  0.125000 seconds of total run time (0.109375 user, 0.015625 system)
  75.76% CPU
  413,349,272 processor cycles
  8,000,016 bytes consed

That was consistent for few times. However, after some time, Emacs was beating
SBCL in sorting.

Emacs for sort was varying 0.015 ~ 0.02; mostly ~0.017.

SBCL, was varying 0.065 ~ 0.085, mostly ~0.065.

For array creation, SBCL is beating Emacs, every time, by a magnitude. Emacs was
around 0.1 ~ 0.12, while SBCL was 0.017 ~ 0.022

Speeds were quite stable for both Emacs and SBCL in later runs.

Unfortunately I only have access to older sbcl version on Windows;
I have seen from the mailing list that they have been working on the sort
implementation so it will be exciting to see what they have come up with.

Emacs version:

GNU Emacs 29.2 (build 2, x86_64-w64-mingw32) of 2024-02-01 (build from GNU ftp
server 29.2_1 for Windows OS - can't build myself configure script fails)

CPU: 13th Gen Intel(R) Core(TM) i5-1345U   1.60 GHz
RAM: 16 GB
OS: Win 11 build 22H2

$ sbcl --version
SBCL 2.3.2



             reply	other threads:[~2024-02-08 23:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-08 23:53 Arthur Miller [this message]
     [not found] <DU2PR02MB10109962DC3D994DCE1BCC11896442@DU2PR02MB10109.eurprd02.prod.outlook.com>
2024-02-09  0:23 ` Some thoughts about Emacs performance Ihor Radchenko
  -- strict thread matches above, loose matches on Subject: below --
2024-02-08  5:44 Robert Boyer
2024-02-08 14:47 ` Ihor Radchenko
2024-02-16 14:08 ` Simon Leinen
2024-02-16 16:15   ` Robert Boyer
2024-02-19 12:29     ` Ihor Radchenko
2024-02-19 19:05       ` Robert Boyer
2024-02-16 16:31   ` Robert Boyer
2024-02-16 18:06   ` Robert Boyer
2024-02-16 18:34   ` Robert Boyer

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

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

  git send-email \
    --in-reply-to=DU2PR02MB10109DA2BC5ACABE9BCAF5A7696442@DU2PR02MB10109.eurprd02.prod.outlook.com \
    --to=arthur.miller@live.com \
    --cc=emacs-devel@gnu.org \
    --cc=robertstephenboyer@gmail.com \
    --cc=yantar92@posteo.net \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.