Subject: Re: bug#50928: remove-dups

From: Dmitry Gutov <[email-masked]>
Date: Fri, 1 Oct 2021 16:16:33 +0300

On 01.10.2021 15:45, Lars Ingebrigtsen wrote:
> This is basically seq-uniq:
> 
> ---
> seq-uniq is an autoloaded compiled Lisp function in ‘seq.el’.
> 
> (seq-uniq SEQUENCE &optional TESTFN)
> ---
> 
> The seq library has a pretty full set of sequence functions, some of
> which overlaps with the older functions like `delete-dups'.

seq-uniq is O(N^2), though, so it's going to be less efficient than

   (delete-dups (copy-sequence list))

I think the idea was to add specialized faster implementations for 
different data types, but that hasn't happened, so far.

And its signature (accepting testfn) might make the obvious optimization 
which delete-dups uses (caching the "known" set in a hash table) not 
feasible. Maybe we could use a hash table for a limited set of testfn's.