From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mark H Weaver Newsgroups: gmane.lisp.guile.bugs Subject: Re: Loop optimization Date: Mon, 07 Mar 2011 19:28:50 -0500 Message-ID: <87wrkaxxod.fsf@netris.org> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1299544310 6671 80.91.229.12 (8 Mar 2011 00:31:50 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 8 Mar 2011 00:31:50 +0000 (UTC) Cc: Guile bug To: Michael Ellis Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Tue Mar 08 01:31:45 2011 Return-path: Envelope-to: guile-bugs@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 1Pwkq0-0006zN-Ta for guile-bugs@m.gmane.org; Tue, 08 Mar 2011 01:31:45 +0100 Original-Received: from localhost ([127.0.0.1]:53133 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pwkq0-0005sB-2m for guile-bugs@m.gmane.org; Mon, 07 Mar 2011 19:31:44 -0500 Original-Received: from [140.186.70.92] (port=38586 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pwknp-0004fZ-Dj for bug-guile@gnu.org; Mon, 07 Mar 2011 19:29:31 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PwknL-0008Kf-7i for bug-guile@gnu.org; Mon, 07 Mar 2011 19:29:00 -0500 Original-Received: from world.peace.net ([216.204.32.208]:46516) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PwknL-0008KZ-4b for bug-guile@gnu.org; Mon, 07 Mar 2011 19:28:59 -0500 Original-Received: from ip68-9-118-38.ri.ri.cox.net ([68.9.118.38] helo=freedomincluded) by world.peace.net with esmtpa (Exim 4.69) (envelope-from ) id 1PwknE-0003Jl-T8; Mon, 07 Mar 2011 19:28:53 -0500 Original-Received: from mhw by freedomincluded with local (Exim 4.69) (envelope-from ) id 1PwknC-0003kX-E3; Mon, 07 Mar 2011 19:28:50 -0500 In-Reply-To: (Michael Ellis's message of "Mon, 7 Mar 2011 18:10:33 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 216.204.32.208 X-BeenThere: bug-guile@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.bugs:5309 Archived-At: Michael Ellis writes: > Thanks for the education, Andy, and congrats again on the guile > compiler implementation. Your version handily outperforms the fastest > python implementation I know. That's especially impressive given that the two pieces of code below are markedly different: The guile version formats 10 million integers and outputs them, whereas the python version does nothing but count and output the final value. I'd be very curious to see the results of a _fair_ comparison. Best, Mark > > for i in xrange (10000000): > pass > print i > > real 0m0.641s > user 0m0.625s > sys 0m0.012s > > > (let loop ((i 0)) > (if (<=3D 10000000 i) > (begin (display i) (newline)) > (loop (1+ i)))) > > > real 0m0.495s > user 0m0.465s > sys 0m0.010s > > Cheers, > Mike > > > > On Mon, Mar 7, 2011 at 4:36 PM, Andy Wingo wrote: >> =C2=A0(let loop ((i 0)) >> =C2=A0 =C2=A0(if (<=3D 10000000 i) >> =C2=A0 =C2=A0 =C2=A0 =C2=A0(begin (display i) (newline)) >> =C2=A0 =C2=A0 =C2=A0 =C2=A0(loop (1+ i))))