From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Miles Bader Newsgroups: gmane.emacs.devel Subject: Re: "simplifications" Date: Mon, 19 Nov 2007 20:33:47 +0900 Message-ID: References: <86ejem1pig.fsf@lola.quinscape.zz> Reply-To: Miles Bader NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1195472057 26747 80.91.229.12 (19 Nov 2007 11:34:17 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 19 Nov 2007 11:34:17 +0000 (UTC) Cc: lekktu@gmail.com, emacs-devel@gnu.org To: David Kastrup Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Nov 19 12:34:22 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Iu4tR-0007Ab-Tj for ged-emacs-devel@m.gmane.org; Mon, 19 Nov 2007 12:34:22 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Iu4tE-0005Tq-D8 for ged-emacs-devel@m.gmane.org; Mon, 19 Nov 2007 06:34:08 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Iu4tA-0005T2-WD for emacs-devel@gnu.org; Mon, 19 Nov 2007 06:34:05 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Iu4t9-0005RD-I0 for emacs-devel@gnu.org; Mon, 19 Nov 2007 06:34:04 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Iu4t9-0005R4-Ah for emacs-devel@gnu.org; Mon, 19 Nov 2007 06:34:03 -0500 Original-Received: from tyo202.gate.nec.co.jp ([202.32.8.206]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Iu4sy-0006pw-Ue; Mon, 19 Nov 2007 06:33:53 -0500 Original-Received: from relay11.aps.necel.com ([10.29.19.46]) by tyo202.gate.nec.co.jp (8.13.8/8.13.4) with ESMTP id lAJBXl2S003185; Mon, 19 Nov 2007 20:33:49 +0900 (JST) Original-Received: from relay21.aps.necel.com ([10.29.19.16] [10.29.19.16]) by relay11.aps.necel.com with ESMTP; Mon, 19 Nov 2007 20:33:49 +0900 Original-Received: from dhapc248.dev.necel.com ([10.114.112.215] [10.114.112.215]) by relay21.aps.necel.com with ESMTP; Mon, 19 Nov 2007 20:33:48 +0900 Original-Received: by dhapc248.dev.necel.com (Postfix, from userid 31295) id 5E26B43C; Mon, 19 Nov 2007 20:33:47 +0900 (JST) System-Type: i686-pc-linux-gnu Blat: Foop In-Reply-To: <86ejem1pig.fsf@lola.quinscape.zz> (David Kastrup's message of "Mon\, 19 Nov 2007 11\:46\:47 +0100") Original-Lines: 37 X-detected-kernel: by monty-python.gnu.org: Solaris 8 (1) 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:83636 Archived-At: David Kastrup writes: > Personally, I think that we should make the byte compiler optimize the > unnecessary binding away. It'd be nice if it did, though you need to analyze the function to make sure there are no hidden uses of that binding; in particular, you need to know if any functions called inside the defsubst might use the dynamic binding of the defsubst's args. [I personally think that's a bit silly, and that it would be enough to just define defsubst as not guaranteeing dynamic bindings of its args, but as a recall, this has been discussed before, and the current behavior declared necessary...] This is one area where lexical binding makes things cheaper: ;; -*- lexical-binding: t -*- (defsubst lcadr (arg) (car (cdr arg))) (defun xxx (x) (lcadr x)) => byte code for xxx: args: (x) interactive: nil 0 dup 1 cdr 2 car 3 return The "dup" is because stack slot 0 is where argument "x" is kept. [Since x is only used once, the dup is unnecessary here, but it's certainly cheaper than varref+varbind.] -Miles -- 80% of success is just showing up. --Woody Allen