bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#27560: 26.0.50; seq-uniq is slow


From: Tino Calancha
Subject: bug#27560: 26.0.50; seq-uniq is slow
Date: Mon, 03 Jul 2017 22:16:53 +0900
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

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 via email to

[Prev in Thread] Current Thread [Next in Thread]