emacs-devel
[Top][All Lists]
Advanced

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

Re: remove-duplicates performances


From: Stefan Monnier
Subject: Re: remove-duplicates performances
Date: Fri, 20 May 2011 11:09:55 -0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

> i just noticed that `remove-duplicates' is very slow.

It's using an O(N²) algorithm, so it's indeed slow for long lists.

> (setq A (let ((seq (loop for i from 1 to 10000 collect i)))
>           (append seq seq)))
> (1 2 3 4 5 6 7 8 9 10 1 2 ...)

For such long lists, I fully expect it to be slow.
But for short lists, the overhead of constructing a hash-table should
make the current code competitive.  Can you try and find out for which
lengths your code is better than the one we have?


        Stefan



reply via email to

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