From: Thierry Volpiatto <thierry.volpiatto@gmail.com>
To: bruce.connor.am@gmail.com
Cc: emacs-devel <emacs-devel@gnu.org>
Subject: Re: What to do for faster `remove-duplicates'?
Date: Wed, 06 May 2015 20:48:02 +0200 [thread overview]
Message-ID: <87a8xhee59.fsf@gmail.com> (raw)
In-Reply-To: <CAAdUY-+z_5W6DGV2gW8a+aLkDm+sOkz+RR5O4ZqCunsjExThRQ@mail.gmail.com>
Artur Malabarba <bruce.connor.am@gmail.com> writes:
>>> Looks good, please install.
>>
>> Not so good as now it is no more destructive for a seq > 100.
>
> Just pushed the following:
>
> modified lisp/subr.el
> @@ -424,12 +424,12 @@ one is kept."
> (unless (gethash elt hash)
> (puthash elt elt hash)
> (push elt res)))
> - (nreverse res))
> + (setcdr list (cdr (nreverse res))))
> (let ((tail list))
> (while tail
> (setcdr tail (delete (car tail) (cdr tail)))
> - (setq tail (cdr tail))))
> - list))
> + (setq tail (cdr tail)))))
> + list)
Also I am not sure pushing to a list (res) and returning this list at
end is faster than returning the maphash.
At first it looks faster but the time spent consing+gc'ing seems longer
than just returning the maphash.
But I may be wrong, just a thought.
--
Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997
next prev parent reply other threads:[~2015-05-06 18:48 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 [this message]
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
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87a8xhee59.fsf@gmail.com \
--to=thierry.volpiatto@gmail.com \
--cc=bruce.connor.am@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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.