From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stephen Berman via "Bug reports for GNU Emacs, the Swiss army knife of text editors" 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 13:33:56 +0100 Message-ID: <877cimuo5n.fsf@gmx.net> References: <86edcvrpzg.fsf@gnu.org> <87bk7yur6p.fsf@gmx.net> Reply-To: Stephen Berman Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22504"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: robertstephenboyer@gmail.com, 69480@debbugs.gnu.org, eliz@gnu.org To: Andrea Corallo Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Mar 01 13:34:48 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 1rg26B-0005aV-W2 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 01 Mar 2024 13:34:48 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rg263-0003ZW-5c; Fri, 01 Mar 2024 07:34:39 -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 1rg25z-0003Yo-MN for bug-gnu-emacs@gnu.org; Fri, 01 Mar 2024 07:34:36 -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 1rg25z-0007CM-DY for bug-gnu-emacs@gnu.org; Fri, 01 Mar 2024 07:34:35 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rg26Q-0002ea-Ae for bug-gnu-emacs@gnu.org; Fri, 01 Mar 2024 07:35:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stephen Berman Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 01 Mar 2024 12:35: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-Cc: Robert Boyer , "Stephen Berman via Bug reports for GNU Emacs, the Swiss army knife of text editors" , Eli Zaretskii , 69480@debbugs.gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.170929648310168 (code B ref -1); Fri, 01 Mar 2024 12:35:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 1 Mar 2024 12:34:43 +0000 Original-Received: from localhost ([127.0.0.1]:36244 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rg267-0002dw-46 for submit@debbugs.gnu.org; Fri, 01 Mar 2024 07:34:43 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:41224) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rg264-0002do-W1 for submit@debbugs.gnu.org; Fri, 01 Mar 2024 07:34:41 -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 1rg25c-0003Xe-Rd for bug-gnu-emacs@gnu.org; Fri, 01 Mar 2024 07:34:12 -0500 Original-Received: from mout.gmx.net ([212.227.15.15]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rg25a-00078R-Jn; Fri, 01 Mar 2024 07:34:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=s31663417; t=1709296437; x=1709901237; i=stephen.berman@gmx.net; bh=TwWm6h9vowGFonkrAjAeBVuUXVaWVwwi9DBsf3447ps=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References: Date; b=jzOi4aZuwFTHpQO7HbaIO/keVFyoCrGWlhyf+IwxbjEVAOkUvLotjkaNCMEFgfcB ECwlRoDdTIbr5kb6eteY2Taa2VvMM509JxtaGEeGI+CxUNzeGk7wWb08hU7JSlX2o ifNEA8GGaW6j0p+O9tGa9KEKykATjpvbhoj5loco26T5ZzWtCLWaizNQHDZ4NSYXd FfTXngWqwbPXlBnnciiZW8KT54wMyTtMmb6EMlIX0KPqR0pMF8ApKhqk4KJbCq8ZQ ohF0eo6PO4KdjbwJkYFDjr7dd9TCc4y70LI1GX//KyizDBn3CCzWzqL1sDsZEJ/nF q5vI/8kuYyuSS129Sw== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Original-Received: from strobelfs2 ([94.134.94.185]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1Mz9Un-1qtieU01ml-00wEKl; Fri, 01 Mar 2024 13:33:57 +0100 In-Reply-To: (Andrea Corallo's message of "Fri, 01 Mar 2024 07:18:29 -0500") X-Provags-ID: V03:K1:zMZkRz420Bw5MXNQ3fScfSpUZPB9htknbaNMZDRG+LugBD4LrWK ivuAmqz+cY/we2kLEfiBKR1sqX6VD0X2FxerGxXnaI/KhUcSTKZDBe1kzUAzyenpQXhE9zq T4gxy4UpaI28Wzt8ssJ4BNxcwns/kr4R+RkaZNap4sdyDZ2oC87eBQ6wqyVA+U9N9kYEgJq vGad+P0ApliW52UfkEOHg== UI-OutboundReport: notjunk:1;M01:P0:k27NFEzpD8M=;eZc8dG/bAcvRu2YUHHZuaSkG2js qVDQsyxo4dYvE1BCdjZdhpfimwu7YAKmSX5mEwNxVpg7J6Wo24dP7LkeqoQDMPwKSUrhKJcw9 /Z6gbDcUjui7fH7D8StbwK/LeNw48Kgu6glgEbm4H5e6if4KUa3vy/phMh68Y6F0hg4oKYXdz LWRarvYNGoXciqTjJ3Y0vjh6bvtwjM1aYfbO3F2ZcvKcn9ee09ggXMpl9NhN9kJM2BEBR56qV qgHxWPBj6Ng99JSS8w5l+bUwhxdLcA8tBxVMjFIxTk6n+1/QjMY4zb4mZW2r61IWYzG8OnGEo Gk229bvHNJIlzyw7N+//M0nFCqptRJpUpwwLZRN749Eeeaeyj8CvIaFldFe4k1/gjSDIjazHo hTGvGaUtuMUNqb6ip1ZHepA0gZBVwQag1xAge0SqrT5RWN767n3kygvyYYGvbCbb817rWgjee PTwks5zBIQi0w1WwiCDHUcpiR3EimYESg3tS0Y8IVdQWyi8Y9fs2jW0NnkQ4rUpUTNYNYDujP UIOB4URM91gfM++3sJS5VRLnZwuovRpfWP+4KXNpZdFjSPi7AHN5CH+QL45V3/MiF2d7iSVGw lgqE2Itwtfp/9KD91aP8i26iFOvEotDT5ytHFU+hhWAsmDUIyOBPSFPas4lGhlqWOFkvnzQDN FfxN0FqBUSSQC+PmvT0nb6oBnl5F/6A556+R9jYxtLr9H8U00jgIn9MI7PuuosW3ws9kBATwk bA1QiUvliOU6A8a6GnJoBBIV+u/ui+pnI7REfPdLNfJwtKRsPBNTZywa4OUfxqp+HiWMs/Ka Received-SPF: pass client-ip=212.227.15.15; envelope-from=stephen.berman@gmx.net; helo=mout.gmx.net X-Spam_score_int: 5 X-Spam_score: 0.5 X-Spam_bar: / X-Spam_report: (0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action 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:280857 Archived-At: On Fri, 01 Mar 2024 07:18:29 -0500 Andrea Corallo wrote: > 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. Ah, ok. > 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. I got these timings with lexical scope: native compiled: (12.717023709000001 1 0.34653286699999997) byte compiled: (9.597325325 1 0.38987931) It's still slower with native compilation than with byte compilation on my machine, unlike on yours. Do you have any idea why? Steve Berman