From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Kastrup Newsgroups: gmane.emacs.devel Subject: Re: Byte compiler inefficiency Date: Tue, 09 Aug 2005 09:06:19 +0200 Message-ID: <85ll3by4gk.fsf@lola.goethe.zz> References: <85acjuhtf0.fsf@lola.goethe.zz> <854qa04o3q.fsf@lola.goethe.zz> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1123580806 24229 80.91.229.2 (9 Aug 2005 09:46:46 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 9 Aug 2005 09:46:46 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Aug 09 11:46:45 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1E2Qg5-0004ns-AY for ged-emacs-devel@m.gmane.org; Tue, 09 Aug 2005 11:45:46 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1E2Qib-00045S-44 for ged-emacs-devel@m.gmane.org; Tue, 09 Aug 2005 05:48:22 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1E2Qeu-0003BV-Kp for emacs-devel@gnu.org; Tue, 09 Aug 2005 05:44:33 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1E2Qeq-000392-Is for emacs-devel@gnu.org; Tue, 09 Aug 2005 05:44:28 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1E2Qeq-000382-9j for emacs-devel@gnu.org; Tue, 09 Aug 2005 05:44:28 -0400 Original-Received: from [199.232.76.164] (helo=fencepost.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.34) id 1E2Qnc-0004dC-AH for emacs-devel@gnu.org; Tue, 09 Aug 2005 05:53:32 -0400 Original-Received: from localhost ([127.0.0.1] helo=lola.goethe.zz) by fencepost.gnu.org with esmtp (Exim 4.34) id 1E2QXe-0006gi-SV; Tue, 09 Aug 2005 05:37:03 -0400 Original-Received: by lola.goethe.zz (Postfix, from userid 1002) id 0E3D41C4DC3E; Tue, 9 Aug 2005 09:06:20 +0200 (CEST) Original-To: rms@gnu.org In-Reply-To: (Richard M. Stallman's message of "Mon, 08 Aug 2005 22:43:48 -0400") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:41759 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:41759 "Richard M. Stallman" writes: > > When cadr is called interpretively, the binding of x is like > > any other binding. > > Sure, but the binding can't possible have any effect on the > result. > > In the particular case of cadr, it can't, because no non-primitive > functions are called. If the compiler could detect this kind of > case, it could do the optimization safely. > > However, if the defsubst calls some non-primitives, they could refer > to the variable, so failing to bind it would be unsafe. Probably it would make sense to put a property on functions that are known not to depend on external bindings. The byte compiler could even propagate this property to functions like cadr. > Implementing the optimization in the former case would be useful, > and I will put it in etc/TODO, but it should not be done until after > the release. Thanks. -- David Kastrup, Kriemhildstr. 15, 44793 Bochum