From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.devel Subject: Re: Compiler optimizations and Guile's module system Date: Sun, 06 Jun 2010 21:49:54 +0200 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1275855038 10065 80.91.229.12 (6 Jun 2010 20:10:38 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 6 Jun 2010 20:10:38 +0000 (UTC) Cc: guile-devel To: No Itisnt Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sun Jun 06 22:10:35 2010 connect(): No such file or directory Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OLMAz-0007TT-BM for guile-devel@m.gmane.org; Sun, 06 Jun 2010 22:10:33 +0200 Original-Received: from localhost ([127.0.0.1]:41008 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OLLwx-0007JO-Vp for guile-devel@m.gmane.org; Sun, 06 Jun 2010 15:56:04 -0400 Original-Received: from [140.186.70.92] (port=53084 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OLLwk-0006kM-MQ for guile-devel@gnu.org; Sun, 06 Jun 2010 15:56:00 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OLLtW-0002KU-SK for guile-devel@gnu.org; Sun, 06 Jun 2010 15:52:32 -0400 Original-Received: from a-pb-sasl-quonix.pobox.com ([208.72.237.25]:45280 helo=sasl.smtp.pobox.com) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OLLtW-0002KM-Pa for guile-devel@gnu.org; Sun, 06 Jun 2010 15:52:30 -0400 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id D2099B9BBA; Sun, 6 Jun 2010 15:52:29 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=sasl; bh=jYShho5kweHVFuYZk97riId+/zo=; b=RVfbqx bq6Z+v/svA6B72WBELWwcSfhJT/22N9zwfMYBxMq7GuwkmMHbsEsE2oc+yTUu2CM N81RQ8qBjH9j4lViIBqQAeZ6OS1a4YENKxGA+ohksdLE8AS463Ak8jNsN0yaN6Kv 75fc+/uZrSYVBQsZhaofYKpX2ixr3yGQOsIOc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=sasl; b=JcuZwZaD8LGXMZH9CjvNwSlCo9l/L05X Nx8kmz7gx8IXvO7ZyXXSafwq/CB0shLNGCaB5DiG6lHsOQdaNjqwsKF4zkYksw1S H4p8NqGNwIOiUGfRxtjbwLDIbluojPOoDvPZwQYdzz95ypQwoI6YmUAbN0SKWpqL EJEWmfkYSOc= Original-Received: from a-pb-sasl-quonix. (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id A4F82B9BB6; Sun, 6 Jun 2010 15:52:28 -0400 (EDT) Original-Received: from unquote (unknown [83.44.188.237]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTPSA id C05D1B9BB1; Sun, 6 Jun 2010 15:52:26 -0400 (EDT) In-Reply-To: (No Itisnt's message of "Fri, 4 Jun 2010 02:25:03 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (gnu/linux) X-Pobox-Relay-ID: 0970F2AA-71A5-11DF-B7ED-6730EE7EF46B-02397024!a-pb-sasl-quonix.pobox.com X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:10445 Archived-At: On Fri 04 Jun 2010 09:25, No Itisnt writes: > I was thinking about inlining, contant propagation, and that class of > optimizations recently. Wouldn't Guile's module system (specifically, > module-set!) interfere with doing these optimizations on module-level > bindings? Yes and no, I think. Inlining is fun, but effectively prevents late binding. When you know you want to integrate a whole block of code, the best thing to do is to express that lexically, by enclosing the whole thing in a `let', for example. You can also specify that certain important bindings are to be inlined by default, for example using define-inlinable, as defined in srfi-9. See http://www.scheme.com/csug8/use.html#./use:h6 for another discussion. > (Bonus whine: Guile currently does this with primitives like +) If it didn't, Guile would be quite slow :) Though, this should be an option. > Off the top of my head, R6RS makes all imported bindings immutable. > How often are cross-module set!s used in Guile? Not often. > Maybe exported bindings could be made immutable by default, and the > module definition would explicitly name variables that should be > mutable by external code, so the compiler knows not to optimize them. > Correct me if I'm wrong here, I've never dealt with this in practice > so I'm just musing out loud. I wouldn't worry about it for now. We can always choose to inline more in the future, but for now the performance bottleneck is native compilation, which will take a couple years to sort itself out nicely. Also consider that the logical end of an aggressive inliner is a whole-program compiler, and I would not want to hack on a program compiled with such a thing: if something does not go according to plan, instead of debugging a live being, you have to do an autopsy on a corpse :P Cheers, Andy -- http://wingolog.org/