From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= Newsgroups: gmane.emacs.devel Subject: Optimise 'while' bodies for effect Date: Thu, 26 Dec 2019 17:59:55 +0100 Message-ID: Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Content-Type: multipart/mixed; boundary="Apple-Mail=_ED9BB670-3A15-4D5F-96AC-C7D3B72D4BB2" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="170754"; mail-complaints-to="usenet@blaine.gmane.org" To: Emacs developers Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Dec 26 18:40:27 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1ikX7Z-000iIn-IU for ged-emacs-devel@m.gmane.org; Thu, 26 Dec 2019 18:40:25 +0100 Original-Received: from localhost ([::1]:55492 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ikX7X-00036k-SL for ged-emacs-devel@m.gmane.org; Thu, 26 Dec 2019 12:40:23 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54675) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ikX7S-00035N-1T for emacs-devel@gnu.org; Thu, 26 Dec 2019 12:40:19 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ikX7Q-0002yy-HC for emacs-devel@gnu.org; Thu, 26 Dec 2019 12:40:17 -0500 Original-Received: from mail1473c50.megamailservers.eu ([91.136.14.73]:44764 helo=mail102c50.megamailservers.eu) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ikX7P-0002yK-Tt for emacs-devel@gnu.org; Thu, 26 Dec 2019 12:40:16 -0500 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1577379598; bh=+pZ7c3IXtuXxI1L7n7N0sr40I8Ileji/yHrQ31fQCmg=; h=From:Subject:Date:To:From; b=fDthLy66g8vA8rYsgUvCJhRNSbJmkvOFwH2by0AnLGWHvEwDfykKQD7b6U1Vw58qf 6uNEOVJuwfdk1P4vSH4d1idXjWB6PRSrvJbEFqtjwiAh+Avka5d9pzMHfDFJHs0ATh 1FbdpXuwg4XXJ75ZU725Lh4+M/iRsCTXzKELA+kY= Feedback-ID: mattiase@acm.or Original-Received: from [192.168.0.4] (c188-150-171-71.bredband.comhem.se [188.150.171.71]) (authenticated bits=0) by mail102c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id xBQGxuik011315 for ; Thu, 26 Dec 2019 16:59:57 +0000 X-Mailer: Apple Mail (2.3445.104.11) X-CTCH-RefID: str=0001.0A0B020B.5E04E70E.0002, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=Q8qsHL+a c=1 sm=1 tr=0 a=SF+I6pRkHZhrawxbOkkvaA==:117 a=SF+I6pRkHZhrawxbOkkvaA==:17 a=M51BFTxLslgA:10 a=tOy_s8lZhS2GKCf9qj4A:9 a=CjuIK1q_8ugA:10 a=jJqh6vEAF0HEFHtUCfQA:9 a=B2y7HmGcmWMA:10 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] [fuzzy] X-Received-From: 91.136.14.73 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:243663 Archived-At: --Apple-Mail=_ED9BB670-3A15-4D5F-96AC-C7D3B72D4BB2 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Optimising the body of 'while' forms for effect (proposed patch = attached) finds the following: In nnheader-find-nov-line: ~/emacs/lisp/gnus/nnheader.el:449:32:Warning: value returned from (=3D = (setq num (read cur)) article) is unused In ldap-search-internal: ~/emacs/lisp/net/ldap.el:528:30:Warning: value returned from (1+ numres) = is unused In org-babel-screen-test: ~/emacs/lisp/org/ob-screen.el:120:4:Warning: value returned from (format "org-babel-screen: File not readable yet.") is unused Not much, perhaps, but worth doing anyway? --Apple-Mail=_ED9BB670-3A15-4D5F-96AC-C7D3B72D4BB2 Content-Disposition: attachment; filename=0001-Optimise-while-bodies-for-effect.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="0001-Optimise-while-bodies-for-effect.patch" Content-Transfer-Encoding: quoted-printable =46rom=20c8cdd32aac98721e2f543fe94134db32a280e371=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20=3D?UTF-8?q?Mattias=3D20Engdeg=3DC3=3DA5rd?=3D=20= =0ADate:=20Thu,=2026=20Dec=202019=2017:50:19=20+0100=0A= Subject:=20[PATCH]=20Optimise=20'while'=20bodies=20for=20effect=0A=0A*=20= lisp/emacs-lisp/byte-opt.el=20(byte-optimize-form-code-walker):=0ATreat=20= all=20expressions=20in=20the=20body=20of=20'while'=20as=20for-effect,=0A= since=20their=20values=20are=20discarded.=20=20This=20also=20finds=20= some=20errors.=0A---=0A=20lisp/emacs-lisp/byte-opt.el=20|=207=20+++++++=0A= =201=20file=20changed,=207=20insertions(+)=0A=0Adiff=20--git=20= a/lisp/emacs-lisp/byte-opt.el=20b/lisp/emacs-lisp/byte-opt.el=0Aindex=20= 22fea1b8da..07fd548dec=20100644=0A---=20a/lisp/emacs-lisp/byte-opt.el=0A= +++=20b/lisp/emacs-lisp/byte-opt.el=0A@@=20-480,6=20+480,13=20@@=20= byte-optimize-form-code-walker=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20backwards)))))=0A=20=09=20=20=20=20=20= (cons=20fn=20(mapcar=20'byte-optimize-form=20(cdr=20form)))))=0A=20=0A+=09= =20=20((eq=20fn=20'while)=0A+=20=20=20=20=20=20=20=20=20=20=20(unless=20= (consp=20(cdr=20form))=0A+=09=20=20=20=20=20(byte-compile-warn=20"too=20= few=20arguments=20for=20`while'"))=0A+=20=20=20=20=20=20=20=20=20=20=20= (cons=20fn=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(cons=20= (byte-optimize-form=20(cadr=20form)=20nil)=0A+=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20(byte-optimize-body=20(cddr=20= form)=20t))))=0A+=0A=20=09=20=20((eq=20fn=20'interactive)=0A=20=09=20=20=20= (byte-compile-warn=20"misplaced=20interactive=20spec:=20`%s'"=0A=20=09=09= =09=20=20=20=20=20=20(prin1-to-string=20form))=0A--=20=0A2.21.0=20(Apple=20= Git-122.2)=0A=0A= --Apple-Mail=_ED9BB670-3A15-4D5F-96AC-C7D3B72D4BB2--