From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Andrea Corallo Newsgroups: gmane.emacs.bugs Subject: bug#69480: Emacs Lisp needs, for its great 'native-compile', 'declare' and 'the' for fixnums and arrays. Date: Fri, 01 Mar 2024 07:18:29 -0500 Message-ID: References: <86edcvrpzg.fsf@gnu.org> <87bk7yur6p.fsf@gmx.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20286"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: robertstephenboyer@gmail.com, eliz@gnu.org, stephen.berman@gmx.net To: 69480@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Mar 01 13:19:50 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1rg1ri-00052t-1U for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 01 Mar 2024 13:19:50 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rg1rU-0003oF-SF; Fri, 01 Mar 2024 07:19:36 -0500 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 1rg1rT-0003nw-Ah for bug-gnu-emacs@gnu.org; Fri, 01 Mar 2024 07:19:35 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rg1rT-0003oW-2H for bug-gnu-emacs@gnu.org; Fri, 01 Mar 2024 07:19:35 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rg1ru-0007xy-H3 for bug-gnu-emacs@gnu.org; Fri, 01 Mar 2024 07:20:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Andrea Corallo Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 01 Mar 2024 12:20:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69480 X-GNU-PR-Package: emacs X-Debbugs-Original-To: Stephen Berman via "Bug reports for GNU Emacs, the Swiss army knife of text editors" X-Debbugs-Original-Cc: Robert Boyer , Eli Zaretskii , Stephen Berman , 69480@debbugs.gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.170929555030556 (code B ref -1); Fri, 01 Mar 2024 12:20:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 1 Mar 2024 12:19:10 +0000 Original-Received: from localhost ([127.0.0.1]:36231 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rg1r3-0007wg-J1 for submit@debbugs.gnu.org; Fri, 01 Mar 2024 07:19:09 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:42180) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rg1qx-0007wN-Uy for submit@debbugs.gnu.org; Fri, 01 Mar 2024 07:19:07 -0500 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 1rg1qT-0003Hw-Rb for bug-gnu-emacs@gnu.org; Fri, 01 Mar 2024 07:18:34 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rg1qS-0003h5-FI; Fri, 01 Mar 2024 07:18:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=vs6pd8qyfJyXDaEL0etOSTJGXk40eRfQKYfcMEuIRRI=; b=XmZjgO3lEEzkzTRbY6uZ i5BjMi/faYRA71TsxQnGuyc/ADK2PfRvmQVWgEMY9Jqqe5P6xU7dqR1+xvma0P5cYZaCWN3RZ4rN/ E0PCJkus3J0yzUR2faFv4umyDsGc/jDXPvLbtta8/n8wHj8Tz9Vr9ll/VH7OqosC2fLlOw/G+/Dv6 2QUGDomz6ZQwnYwRlQ79Vspx34U9p0DaigmTYVNbb8+GHVRKUeEWHy+LrqDLbZYfXLW7bIkI4+C+/ pJ7h+N1OslWMlOksgvX5/XMWN1+rt0zEQPC4ZmXq1CdxiUdDVVzSG7SWmJgqxDvEn9tlXWwqAw9k9 Pr7kKgQayMR0/w==; Original-Received: from acorallo by fencepost.gnu.org with local (Exim 4.90_1) (envelope-from ) id 1rg1qP-0002Nz-Hz; Fri, 01 Mar 2024 07:18:30 -0500 In-Reply-To: <87bk7yur6p.fsf@gmx.net> (Stephen Berman via's message of "Fri, 01 Mar 2024 12:28:30 +0100") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:280855 Archived-At: Stephen Berman via "Bug reports for GNU Emacs, the Swiss army knife of text editors" writes: > On Thu, 29 Feb 2024 22:10:27 +0200 Eli Zaretskii wrote: > >>> From: Robert Boyer >>> 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? Because the file is not lexically scoped so we are not running optimizations. On my laptop I see: 11 secs byte compiled 18 secs native compiled 7 secs byte compiled with lexical scope 5 secs native compiled with lexical scope. Bests Andrea