From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: tomas@tuxteam.de Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] use tail pointer for LOOP Date: Thu, 17 Jun 2010 16:05:01 +0200 Message-ID: <20100617140501.GA29261@tomas> References: <4C01AA28.6030002@censorshipresearch.org> <9718A5AD-7A74-470B-A32D-DA14266506A3@raeburn.org> <4C01B609.6070303@censorshipresearch.org> <20100616174420.GA2847@tomas> <87fx0msv9z.fsf@lola.goethe.zz> <20100617051021.GA26623@tomas> <87mxuu5dq3.fsf@ambire.localdomain> <20100617092232.GA27846@tomas> <87iq5i563f.fsf@ambire.localdomain> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; x-action=pgp-signed Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1276784410 20672 80.91.229.12 (17 Jun 2010 14:20:10 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 17 Jun 2010 14:20:10 +0000 (UTC) Cc: emacs-devel@gnu.org To: Thien-Thi Nguyen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jun 17 16:20:08 2010 connect(): No such file or directory 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.69) (envelope-from ) id 1OPFwt-0003YS-5G for ged-emacs-devel@m.gmane.org; Thu, 17 Jun 2010 16:20:07 +0200 Original-Received: from localhost ([127.0.0.1]:58545 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OPFwp-0002E3-25 for ged-emacs-devel@m.gmane.org; Thu, 17 Jun 2010 10:20:03 -0400 Original-Received: from [140.186.70.92] (port=50172 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OPFu2-0007ne-EN for emacs-devel@gnu.org; Thu, 17 Jun 2010 10:17:17 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OPFht-0002mY-2b for emacs-devel@gnu.org; Thu, 17 Jun 2010 10:04:38 -0400 Original-Received: from alextrapp1.equinoxe.de ([217.22.192.104]:41692 helo=www.elogos.de) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OPFhs-0002mK-Tw for emacs-devel@gnu.org; Thu, 17 Jun 2010 10:04:37 -0400 Original-Received: by www.elogos.de (Postfix, from userid 1000) id A770C9004D; Thu, 17 Jun 2010 16:05:01 +0200 (CEST) Content-Disposition: inline In-Reply-To: <87iq5i563f.fsf@ambire.localdomain> User-Agent: Mutt/1.5.15+20070412 (2007-04-11) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) 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:126079 Archived-At: -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Thu, Jun 17, 2010 at 12:03:16PM +0200, Thien-Thi Nguyen wrote: > () tomas@tuxteam.de > () Thu, 17 Jun 2010 11:22:32 +0200 >=20 > Cute. You all are successfully keeping me from work. Enjoing it ;-) >=20 > Here are the results. Attached the modified source. >=20 > copy1: (1.058881 5 0.7366780000000048) > copy2: (1.27958 6 0.8913360000000026) > copy3: (1.337353 6 0.9249420000000015) >=20 > Still the reverse version is the winner. Yours seems to be a tad slo= wer > (although I wouldn't know whether it's in the noise). >=20 > But it looks so sharp ;-) >=20 > How about this one? >=20 > (defun copy4 (lst) > "Return a copy of LST." > (let* ((box (list nil)) > (tp box)) > (while lst > (setq tp (setcdr tp (list (pop lst))))) > (cdr box))) Here you go: copy1: (1.115929 5 0.7795429999999997) copy2: (1.210733 5 0.8172469999999996) copy3: (1.2816079999999999 5 0.8502519999999998) copy4: (1.295846 5 0.9325959999999993) (I did implement the garbage-collect-before-each-run as you suggested in your other mail: this can be nicely seen in the constant number "5" above). I won't spam this list with the modified source (unless someone clamours for it, that is). So without the GC the gap narrows significantly. But still: reverse's the king of the hill. OTOH, the differences in GC times start to be a considerable fraction of the whole difference, so I might be measuring noise anyway. Seems we can't beat an old Lisp idiom (my guess is that Lisp is alien technology, but hey). Regards - -- tom=C3=A1s -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFMGiuNBcgs9XrR2kYRApnTAJ9Lo7J8EHjOr8JMthPQa/E9zwrEIQCePKI4 b7laoSJWtxDrlrzPeDNkhzE=3D =3DS9WC -----END PGP SIGNATURE-----