emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] use tail pointer for LOOP


From: tomas
Subject: Re: [PATCH] use tail pointer for LOOP
Date: Thu, 17 Jun 2010 11:22:32 +0200
User-agent: Mutt/1.5.15+20070412 (2007-04-11)

On Thu, Jun 17, 2010 at 09:18:28AM +0200, Thien-Thi Nguyen wrote:
> () address@hidden
> () Thu, 17 Jun 2010 07:10:21 +0200
> 
>    Still, reversing seems to be worth it (by some 30 percent).
>    Unless we find some way to streamline the tail pointer better.
> 
> How does this variant fare?
> 
> (defun copy3 (lst)
>   "Return a copy of LST."
>   (let* ((box (list nil))
>          (tp box))
>     (while lst
>       (setq tp (cdr (nconc tp (list (pop lst))))))
>     (cdr box)))

Cute. You all are successfully keeping me from work. Enjoing it ;-)

Here are the results. Attached the modified source.

  copy1: (1.058881 5 0.7366780000000048)
  copy2: (1.27958 6 0.8913360000000026)
  copy3: (1.337353 6 0.9249420000000015)

Still the reverse version is the winner. Yours seems to be a tad slower
(although I wouldn't know whether it's in the noise).

But  it looks so sharp ;-)

Thanks, regards
-- tomás

Attachment: bm.el
Description: Text document

Attachment: signature.asc
Description: Digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]