From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Robert Boyer Newsgroups: gmane.emacs.bugs Subject: bug#69249: bug in native-compile? Date: Sun, 18 Feb 2024 16:25:30 -0600 Message-ID: References: <86h6i5r20h.fsf@gnu.org> <8734tp5uoq.fsf@igel.home> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000a733240611af761f" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2353"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 69249@debbugs.gnu.org, Eli Zaretskii , Andrea Corallo , Stefan Monnier , rms@gnu.org To: Andreas Schwab Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Feb 19 04:19:58 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 1rbuCE-0000PG-0L for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 19 Feb 2024 04:19:58 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rbuBy-0003Qz-GW; Sun, 18 Feb 2024 22:19:42 -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 1rbuBx-0003Qn-Pq for bug-gnu-emacs@gnu.org; Sun, 18 Feb 2024 22:19:41 -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 1rbuBx-0007YC-HT for bug-gnu-emacs@gnu.org; Sun, 18 Feb 2024 22:19:41 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rbuCI-0008Kz-9m for bug-gnu-emacs@gnu.org; Sun, 18 Feb 2024 22:20:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Robert Boyer Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 19 Feb 2024 03:20:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69249 X-GNU-PR-Package: emacs Original-Received: via spool by 69249-submit@debbugs.gnu.org id=B69249.170831277031975 (code B ref 69249); Mon, 19 Feb 2024 03:20:02 +0000 Original-Received: (at 69249) by debbugs.gnu.org; 19 Feb 2024 03:19:30 +0000 Original-Received: from localhost ([127.0.0.1]:40084 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rbuBl-0008JY-Gi for submit@debbugs.gnu.org; Sun, 18 Feb 2024 22:19:30 -0500 Original-Received: from mail-ej1-f48.google.com ([209.85.218.48]:57495) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rbpdG-0000T3-Pg for 69249@debbugs.gnu.org; Sun, 18 Feb 2024 17:27:36 -0500 Original-Received: by mail-ej1-f48.google.com with SMTP id a640c23a62f3a-a36126ee41eso485080366b.2 for <69249@debbugs.gnu.org>; Sun, 18 Feb 2024 14:27:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708295168; x=1708899968; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=JVdrSZWiXpdkLEIz5FNze6XQ/Cp5BuPH9EMA/lBhJxY=; b=i1sWXtC5au5yaNuhUNu0FpYZx2aHRApiT47Z10KnHHaL4e3jHC0YMvxTbxz0iodYVT KnxtId6znHXWLJhbB9q4OvzQT5Omzk7Gktpg11gDfzp0AClOI6a0A+IjvBcL8hdt38NH nQ+qdf13dxxzn7BrOenR0CfOYd79RP+i1NnoFzKztwO8lIYFxc1vhVg4dQGSAywCSggL 4hOtp8asUavY8Irjkb7VLtx8pbcGzKFmWPMNSHFrIV7bWXLwcrV564xBXzopmtIw38LT 9NJQPdUmy9fy89lLMuhUxIymraoBypS6Ed12hDpIvwU3kXFByMtv4strpfB2Q4S1oFyO 7sfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708295168; x=1708899968; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=JVdrSZWiXpdkLEIz5FNze6XQ/Cp5BuPH9EMA/lBhJxY=; b=obUlhFU4P92Ohq9Aw1b2Z3dO2aLu3T+QrZbR5wCUt169hXJv+0RMO1knyguJZ4FIds p0eRd3gByrO3qf9hrhS5GpqkQe9FPFflanQHMMKmnXctE1FdwoS6ybIQo84uGq2cZDNC /XUl1zs9fqK1ALhdR7NK9vL6XaigZecmuNlB7paY166KHXAgOrreQPCoIwvDYBqZoRsB 9/cT56JumSJTH9IlQd8rjTIfi2Lv+1urLa8m98YhCZdLnOBCXBJ2SZhcnmdFAH129Fsu tJFfBToCNto07QYPg7cSVo7du4H9CfiCEJ+XHWltyh8WMNva/b1WSoe7fmV+/CRosRrC yIxQ== X-Forwarded-Encrypted: i=1; AJvYcCWFWpWLYDUWiFvo32z2TVMyQ9EFS0p+1LaJMKnZoWMryxeeSl33Rlp6YkSZ8AheUAKvYeaqsSqEaxzfpqrivzsvffZDt/g= X-Gm-Message-State: AOJu0Yx8YBRuyFABMj6op65s6OHyf+lRiYIQs9pw63AfhePVxdqoW/jw iuoLRMRIa7YSGvwt9oYK5PXL4X9Va+gxl49sNlLhrRMu0i/q8tk0L2ze/MJNl+b4dzxwatCkDiM B3feZBS4NniM9aiCKTzwaYJiUxUM= X-Google-Smtp-Source: AGHT+IGY4v2Q0AjgzihFWwHvba+mkYK03kt/JqmmAq54RXcHukSN0P1HbI/TApLFNpEHxX6gPRHscOFDlbAGvNu9sAU= X-Received: by 2002:a17:906:2b53:b0:a3e:5adb:cb21 with SMTP id b19-20020a1709062b5300b00a3e5adbcb21mr1847449ejg.59.1708295167880; Sun, 18 Feb 2024 14:26:07 -0800 (PST) In-Reply-To: X-Mailman-Approved-At: Sun, 18 Feb 2024 22:19:27 -0500 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:280225 Archived-At: --000000000000a733240611af761f Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable And you should know what DECLARE and THE do for AREF. All the difference in the world, and I will give you a simple demo if you wish. Bob On Sun, Feb 18, 2024 at 4:19=E2=80=AFPM Robert Boyer wrote: > This message is about how important DECLARE and THE are. If you do not > handle DECLARE and THE right, people will laugh at native-compile. > > Here is an SBCL transcript. I am running on a $100 Lenovo Chromebook. > > I got SBCL with the command sudo apt-get install sbcl. > > * (declaim (optimize (safety 0) (speed 3) (debug 0))) > NIL > * (defun foo-with-declare (n) > (let ((i 0) > (sum 0) > (max (expt 10 n))) > (declare (fixnum i sum max)) > (loop (cond ((<=3D i max) > (setq sum (the fixnum (+ sum i)))) > (t (return sum))) > (incf i)))) > FOO-WITH-DECLARE > * (time (foo-with-declare 8)) > Evaluation took: > 0.125 seconds of real time > 0.123203 seconds of total run time (0.123193 user, 0.000010 system) > 98.40% CPU > 135,905,516 processor cycles > 0 bytes consed > 5000000050000000 > * (defun foo-without-declare (n) > (let ((i 0) > (sum 0) > (max (expt 10 n))) > (loop (cond ((<=3D i max) > (setq sum (+ sum i))) > (t (return sum))) > (incf i)))) > WARNING: redefining COMMON-LISP-USER::FOO-WITHOUT-DECLARE in DEFUN > FOO-WITHOUT-DECLARE > * (time (foo-without-declare 8)) > Evaluation took: > 1.080 seconds of real time > 1.072932 seconds of total run time (1.072932 user, 0.000000 system) > 99.35% CPU > 1,181,369,303 processor cycles > 0 bytes consed > 5000000050000000 > > People go wow about 8X. How does native-compile do? > > There is a great song by Alabama 'If you gonna play in Texas, you gotta > have a fiddle in the band'. Check it out! > > https://www.youtube.com/watch?v=3Dw6r4E514nJg > > Bob > > > Bob > > > On Sun, Feb 18, 2024 at 3:28=E2=80=AFPM Andreas Schwab > wrote: > >> On Feb 18 2024, Robert Boyer wrote: >> >> > Furthermore, such declare forms are necessary for life as we know it >> > in the free world, so that fixnum arithmetic can be used where >> > appropriate! >> >> If you are programming in Emacs Lisp, you need to follow the rules of >> Emacs Lisp. >> >> -- >> Andreas Schwab, schwab@linux-m68k.org >> GPG Key fingerprint =3D 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AE= C1 >> "And now for something completely different." >> > > > -- > Anything I seem to state should be taken as a question. I am at least 77 > and feeble. > --=20 Anything I seem to state should be taken as a question. I am at least 77 and feeble. --000000000000a733240611af761f Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
And you should know what DECLARE and THE do for AREF.=C2= =A0 All the difference in the world, and I will give you a simple demo if y= ou wish.

Bob

<= div dir=3D"ltr" class=3D"gmail_attr">On Sun, Feb 18, 2024 at 4:19=E2=80=AFP= M Robert Boyer <robertst= ephenboyer@gmail.com> wrote:
This message is about how important DECLARE and THE are.=C2=A0 If = you do not
handle DECLARE and THE= right, people will laugh=C2=A0at native-compile.

Here is=C2=A0an SBCL transcript.=C2=A0 I = am running on a $100 Lenovo Chromebook.

I got SB= CL with the command=C2=A0sudo apt-get install sbcl.

* (declaim (op= timize (safety 0) (speed 3) (debug 0)))
NIL
* (defun foo-with-declare= (n)
=C2=A0 (let ((i 0)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (sum 0)
=C2=A0= =C2=A0 =C2=A0 =C2=A0 (max (expt 10 n)))
=C2=A0 =C2=A0 (declare (fixnum = i sum max))
=C2=A0 =C2=A0 (loop (cond ((<=3D i max)
=C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(setq sum (the fixnum (+ s= um i))))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (t (ret= urn sum)))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (incf i))))
FOO-WITH-DE= CLARE
* (time (foo-with-declare 8))
Evaluation took:
=C2=A0 0.125 = seconds of real time
=C2=A0 0.123203 seconds of total run time (0.123193= user, 0.000010 system)
=C2=A0 98.40% CPU
=C2=A0 135,905,516 processo= r cycles
=C2=A0 0 bytes consed
5000000050000000
* (defun foo-witho= ut-declare (n)
=C2=A0 (let ((i 0)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (sum 0)=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (max (expt 10 n)))
=C2=A0 =C2=A0 (loop (= cond ((<=3D i max)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0(setq sum (+ sum i)))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 (t (return sum)))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 (incf i))))
WARNING: redefining COMMON-LISP-USER::FOO-WITHOUT-DECLAR= E in DEFUN
FOO-WITHOUT-DECLARE
* (time (foo-without-declare 8))
Ev= aluation took:
=C2=A0 1.080 seconds of real time
=C2=A0 1.072932 seco= nds of total run time (1.072932 user, 0.000000 system)
=C2=A0 99.35% CPU=
=C2=A0 1,181,369,303 processor cycles
=C2=A0 0 bytes consed
50000= 00050000000

<= /font>
People go wow about 8X.=C2=A0 How= does native-compile do?

There is a great song by Alabama = 9;If you gonna=C2=A0play in Texas, you gotta have a fiddle in the band'= . Check it out!


Bob


= Bob


On Sun, Feb 18, 2024 at 3:28=E2=80= =AFPM Andreas Schwab <schwab@linux-m68k.org> wrote:
On Feb 18 202= 4, Robert Boyer wrote:

> Furthermore, such declare forms are necessary for life as we know it > in the free world, so that fixnum arithmetic can be used where
> appropriate!

If you are programming in Emacs Lisp, you need to follow the rules of
Emacs Lisp.

--
Andreas Schwab, = schwab@linux-m68k.org
GPG Key fingerprint =3D 7578 EB47 D4E5 4D69 2510=C2=A0 2552 DF73 E780 A9DA = AEC1
"And now for something completely different."


--
Anythin= g I seem to state should be taken as a question.=C2=A0 I am at least 77 and= feeble.


--
Anything I seem to state should be taken as a question.=C2= =A0 I am at least 77 and feeble.
--000000000000a733240611af761f--