From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Thierry Volpiatto <thierry.volpiatto@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: remove-duplicates performances
Date: Fri, 20 May 2011 11:09:55 -0300 [thread overview]
Message-ID: <jwvr57tv52f.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <877h9lv5tl.fsf@gmail.com> (Thierry Volpiatto's message of "Fri, 20 May 2011 15:51:02 +0200")
> 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
next prev parent reply other threads:[~2011-05-20 14:09 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-20 13:51 remove-duplicates performances Thierry Volpiatto
2011-05-20 14:09 ` Stefan Monnier [this message]
2011-05-20 14:39 ` Thierry Volpiatto
2011-05-20 16:14 ` Stefan Monnier
2011-05-20 17:46 ` Thierry Volpiatto
2011-05-20 15:16 ` Ted Zlatanov
2011-05-20 14:28 ` David Kastrup
2011-05-20 16:00 ` Thierry Volpiatto
2011-05-20 17:01 ` David Kastrup
2011-05-20 17:31 ` Thierry Volpiatto
2011-05-20 17:46 ` David Kastrup
2011-05-20 18:01 ` Stefan Monnier
2011-05-20 21:57 ` Pascal J. Bourguignon
2011-05-20 17:57 ` Ted Zlatanov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwvr57tv52f.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=emacs-devel@gnu.org \
--cc=thierry.volpiatto@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).