unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stephen Berman via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Robert Boyer <robertstephenboyer@gmail.com>, 69480@debbugs.gnu.org
Subject: bug#69480: Emacs Lisp needs, for its great 'native-compile', 'declare' and 'the' for fixnums and arrays.
Date: Fri, 01 Mar 2024 12:28:30 +0100	[thread overview]
Message-ID: <87bk7yur6p.fsf@gmx.net> (raw)
In-Reply-To: <86edcvrpzg.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 29 Feb 2024 22:10:27 +0200")

On Thu, 29 Feb 2024 22:10:27 +0200 Eli Zaretskii <eliz@gnu.org> wrote:

>> From: Robert Boyer <robertstephenboyer@gmail.com>
>> Date: Thu, 29 Feb 2024 13:40:14 -0600
>>
>> Consider this form:
>>
>> (progn (emacs-lisp-native-compile-and-load) (benchmark (build-sieve (expt 10
>> 8)) 1))
>>
>> First of all, 'benchmark' has an obvious bug because it reports a time of
>> .000005 seconds.
>
> You use benchmark incorrectly.  And you should use benchmark-run
> instead, anyway.
>
>> After finding the file eratosthenese.el, the evaluation of the form above
>> takes 69 seconds in Emacs.
>>
>> After entering SBCL and loading eratosthenese.lisp, (build-sieve (expt 10 8))
>> takes 8 seconds.
>
> It takes 16.7 sec on my system.

I was curious to see how long it takes on my system, compared to the
byte-compiled and uncompiled files, and the results surprised me.
First, I visited the file eratosthenes.el, ran `eval-buffer' and then
`M-: (benchmark-run nil (build-sieve (expt 10 8)))', with this result:

(143.326808051 1 0.344846223)

Then I ran `M-: (progn (emacs-lisp-native-compile-and-load)
(benchmark-run nil (build-sieve (expt 10 8))))', with this result:

(37.457440511 1 0.36922945500000004)

The native compilation also produced a byte-compiled file
eratosthenes.elc, so I then loaded that file and again ran `M-:
(benchmark-run nil (build-sieve (expt 10 8)))', with this result:

(21.854069551000002 1 0.3595161699999999)

I was surprised that this was much faster than the run with native
compilation, but I thought perhaps this was due to the time spent
producing both the native and byte-compiled files (though more than 15
seconds for that seemed unlikely), so I ran `M-: (progn
(emacs-lisp-native-compile-and-load) (benchmark-run nil (build-sieve
(expt 10 8))))' again, which just loaded the already native-compiled
file (and updated its timestamp), but the result was practically the
same as the first time:

(37.095767574 1 0.36986937500000017)

Why is the timing with native compilation so much slower than with byte
compilation?

Steve Berman





  parent reply	other threads:[~2024-03-01 11:28 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-29 19:40 bug#69480: Emacs Lisp needs, for its great 'native-compile', 'declare' and 'the' for fixnums and arrays Robert Boyer
2024-02-29 20:10 ` Eli Zaretskii
2024-02-29 20:54   ` Robert Boyer
2024-02-29 22:10     ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-01  6:45     ` Eli Zaretskii
2024-02-29 21:04   ` Robert Boyer
2024-03-01 11:28   ` Stephen Berman via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-03-01 12:18     ` Andrea Corallo
2024-03-01 12:33       ` Stephen Berman via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-01 12:45         ` Eli Zaretskii
2024-03-01 13:07           ` Stephen Berman via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-01 13:41             ` Eli Zaretskii
2024-03-01 13:53               ` Stephen Berman via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-01 14:07                 ` Andrea Corallo
2024-03-01 14:35                   ` Stephen Berman via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-01 16:10                     ` Andrea Corallo
2024-03-01 19:36                       ` Stephen Berman via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-01 16:34                 ` Eli Zaretskii
2024-03-01 19:36                   ` Stephen Berman via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-01 12:40       ` Eli Zaretskii
2024-03-01 12:34     ` 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=87bk7yur6p.fsf@gmx.net \
    --to=bug-gnu-emacs@gnu.org \
    --cc=69480@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=robertstephenboyer@gmail.com \
    --cc=stephen.berman@gmx.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 public inbox

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

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).