From: Thierry Volpiatto <thierry.volpiatto@gmail.com>
To: emacs-devel@gnu.org
Subject: Re: remove-duplicates performances
Date: Fri, 20 May 2011 19:46:30 +0200 [thread overview]
Message-ID: <87ei3tcljd.fsf@gmail.com> (raw)
In-Reply-To: jwvboyxuzft.fsf-monnier+emacs@gnu.org
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> I go down to a list of 10 elements and it still faster:
>
> I'm not surprised the break-even is less than 10.
>
>> liste de 2X10 éléments:
>> remove-duplicates 1 0.000209 0.000209
>> remove-dups 1 3.6e-05 3.6e-05
>
>> liste de 2X5 éléments:
>> remove-duplicates 1 7.3e-05 7.3e-05
>> remove-dups 1 6.4e-05 6.4e-05
>
> Hmm... so it's faster to do it for 20 than for 10?
Yes, i didn't notice that, i redo it and i have now:
For 10X2==>remove-dups 1 5.2e-05 5.2e-05
For 5X2==> remove-dups 1 5.4e-05 5.4e-05
Don't know why.
Can you try on your side?
> I expect it is common to call remove-duplicates with very short lists
> (shorter than 10 for sure) that present (almost) no duplication.
Well, on small list, (shorter than ten), no need to have such a complex
function, most of the time i use something like:
(loop for i in '(a b a c b c)
unless (memq i ls) collect i into ls
finally return ls)
I just tried remove-duplicates in common-lisp (slime) and i see the
result on big list is instant.(i didn't instrument though)
--
A+ Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997
next prev parent reply other threads:[~2011-05-20 17:46 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
2011-05-20 14:39 ` Thierry Volpiatto
2011-05-20 16:14 ` Stefan Monnier
2011-05-20 17:46 ` Thierry Volpiatto [this message]
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=87ei3tcljd.fsf@gmail.com \
--to=thierry.volpiatto@gmail.com \
--cc=emacs-devel@gnu.org \
/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).