emacs-devel
[Top][All Lists]
Advanced

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

Re: What to do for faster `remove-duplicates'?


From: Artur Malabarba
Subject: Re: What to do for faster `remove-duplicates'?
Date: Wed, 6 May 2015 19:33:07 +0100

But that nreverse could be optimized out if the first loop followed a
`while'+`setcdr' strategy like the second.

2015-05-06 19:31 GMT+01:00 Artur Malabarba <address@hidden>:
>>> Looks good, please install.
>>
>> Not so good as now it is no more destructive for a seq > 100.
>
> Just pushed the following:
>
> modified   lisp/subr.el
> @@ -424,12 +424,12 @@ one is kept."
>            (unless (gethash elt hash)
>              (puthash elt elt hash)
>              (push elt res)))
> -        (nreverse res))
> +        (setcdr list (cdr (nreverse res))))
>      (let ((tail list))
>        (while tail
>          (setcdr tail (delete (car tail) (cdr tail)))
> -        (setq tail (cdr tail))))
> -    list))
> +        (setq tail (cdr tail)))))
> +  list)



reply via email to

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