unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Tino Calancha <tino.calancha@gmail.com>
To: Nicolas Petton <nicolas@petton.fr>
Cc: 27560@debbugs.gnu.org, ohwoeowho@gmail.com, tino.calancha@gmail.com
Subject: bug#27560: 26.0.50; seq-uniq is slow
Date: Mon, 03 Jul 2017 22:16:53 +0900	[thread overview]
Message-ID: <87inj964oq.fsf@calancha-pc> (raw)
In-Reply-To: <8760farkxt.fsf@petton.fr> (Nicolas Petton's message of "Mon, 03 Jul 2017 10:20:14 +0200")

Nicolas Petton <nicolas@petton.fr> writes:

> Oleh (in Cc) did some benchmarks in May 2015, and `seq-uniq' is quite
> slow:
>
>     (setq cands (locate-file-completion-table
> 		 load-path (get-load-suffixes) "" nil t))
>     (length cands)
>     5357
>     (length (cl-remove-duplicates cands :test 'equal))
>     2481
>     (benchmark-run (cl-remove-duplicates cands :test 'equal))
>     (0.67873101 0 0.0)
>     (benchmark-run (helm-fast-remove-dups cands :test 'equal))
>     (0.001350054 0 0.0)
>     (benchmark-run (seq-uniq cands 'equal))
>     (5.270219822 27 2.396615401000002)
>
> One easy way to make it faster would be to use `cl-remove-duplicates'
> for sequences (sequencep), and default to the current implementation for
> other seqp data structures (which means stream.el currently AFAIK).
The numbers above are Oleh's numbers from 2015.
If i run similar benchmarks now i don't get such impressive
difference between cl-lib/seq:

(setq cands (locate-file-completion-table
		 load-path (get-load-suffixes) "" nil t))
("cc-compat" "vi" "longlines" "rcompile" "eudcb-ph" "yow" "fast-lock" "cl-compat" "mouse-sel" "tpu-mapper" "otodo-mode" "levents" ...)
(length cands)
5317
(length (cl-remove-duplicates cands :test 'equal))
1716

;; Each benchmark run 5 times:

(benchmark-run 1 (helm-fast-remove-dups cands :test 'equal))
(0.003539776 0 0.0)
(0.007002079 0 0.0)
(0.006296864 0 0.0)
(0.002854921 0 0.0)
(0.009388854 0 0.0)

(benchmark-run 1 (cl-remove-duplicates cands :test 'equal))
(0.558590947 0 0.0)
(0.554376583 0 0.0)
(0.554984501 0 0.0)
(0.583015589 0 0.0)
(0.565781774 0 0.0)

(benchmark-run 1 (seq-uniq cands 'equal))
(0.36366049 0 0.0)
(0.37484882 0 0.0)
(0.604267587 1 0.22640233999999282)
(0.360611939 0 0.0)
(0.392288023 0 0.0)

Tino





  reply	other threads:[~2017-07-03 13:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-03  8:20 bug#27560: 26.0.50; seq-uniq is slow Nicolas Petton
2017-07-03 13:16 ` Tino Calancha [this message]
2017-07-03 13:50   ` Nicolas Petton
2017-07-03 13:52     ` Nicolas Petton
2017-07-03 14:09       ` Nicolas Petton
2017-07-03 14:19         ` Tino Calancha

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=87inj964oq.fsf@calancha-pc \
    --to=tino.calancha@gmail.com \
    --cc=27560@debbugs.gnu.org \
    --cc=nicolas@petton.fr \
    --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).