From: Artur Malabarba <bruce.connor.am@gmail.com>
To: Oleh Krehel <ohwoeowho@gmail.com>
Cc: Stefan Monnier <monnier@iro.umontreal.ca>,
emacs-devel <emacs-devel@gnu.org>
Subject: Re: What to do for faster `remove-duplicates'?
Date: Wed, 6 May 2015 15:49:11 +0100 [thread overview]
Message-ID: <CAAdUY-L99G-qJpzcHkLTqoTTHPpfQvYw+DC66rJKXNz=f+kyPg@mail.gmail.com> (raw)
In-Reply-To: <87ioc5kd54.fsf@gmail.com>
>>> I attach the patch. I did a bunch of `benchmark-run' and it seems that
>>> 100 elements is the breaking point.
>>
>> Small question. How much slower is this patch compared to the current
>> version on a list of 99 elements? (Due to having to calculate the
>> length)
>
> For 99 unique candidates, the call to `length' takes 5% time compared to
> the call to `delete-dups':
>
> (/ 3.774e-06 6.3028e-05)
> 0.05987814939392017
>
> It becomes worse for a small amount of unique candidates, going to 30%
> for 10 candidates, but a lot of that is the standard cost of calling a
> function.
>
> I don't know if it's worth optimizing further.
Nah, I think it's fine, I was just curious.
Doing (nthcdr 100 list) instead of (> (length list) 100) might improve
that a little, but either way is fine.
prev parent reply other threads:[~2015-05-06 14:49 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-06 7:33 What to do for faster `remove-duplicates'? Oleh Krehel
2015-05-06 12:59 ` Stefan Monnier
2015-05-06 13:30 ` Oleh Krehel
2015-05-06 13:50 ` Stefan Monnier
2015-05-06 13:51 ` Oleh Krehel
2015-05-06 17:43 ` Thierry Volpiatto
2015-05-06 17:54 ` Oleh Krehel
2015-05-06 18:31 ` Artur Malabarba
2015-05-06 18:33 ` Artur Malabarba
2015-05-06 18:41 ` Oleh Krehel
2015-05-06 19:24 ` Artur Malabarba
2015-05-06 19:32 ` Oleh Krehel
2015-05-06 21:22 ` Artur Malabarba
2015-05-06 18:48 ` Thierry Volpiatto
2015-05-06 20:54 ` Stefan Monnier
2015-05-06 20:54 ` Stefan Monnier
2015-05-06 21:18 ` Artur Malabarba
2015-05-06 14:04 ` Artur Malabarba
2015-05-06 14:13 ` Oleh Krehel
2015-05-06 14:49 ` Artur Malabarba [this message]
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='CAAdUY-L99G-qJpzcHkLTqoTTHPpfQvYw+DC66rJKXNz=f+kyPg@mail.gmail.com' \
--to=bruce.connor.am@gmail.com \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
--cc=ohwoeowho@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).