* bug#27560: 26.0.50; seq-uniq is slow
@ 2017-07-03 8:20 Nicolas Petton
2017-07-03 13:16 ` Tino Calancha
0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Petton @ 2017-07-03 8:20 UTC (permalink / raw)
To: 27560; +Cc: ohwoeowho
[-- Attachment #1: Type: text/plain, Size: 733 bytes --]
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).
Nico
[-- Attachment #2.1: Type: text/plain, Size: 0 bytes --]
[-- Attachment #2.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#27560: 26.0.50; seq-uniq is slow
2017-07-03 8:20 bug#27560: 26.0.50; seq-uniq is slow Nicolas Petton
@ 2017-07-03 13:16 ` Tino Calancha
2017-07-03 13:50 ` Nicolas Petton
0 siblings, 1 reply; 6+ messages in thread
From: Tino Calancha @ 2017-07-03 13:16 UTC (permalink / raw)
To: Nicolas Petton; +Cc: 27560, ohwoeowho, tino.calancha
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#27560: 26.0.50; seq-uniq is slow
2017-07-03 13:16 ` Tino Calancha
@ 2017-07-03 13:50 ` Nicolas Petton
2017-07-03 13:52 ` Nicolas Petton
0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Petton @ 2017-07-03 13:50 UTC (permalink / raw)
To: Tino Calancha; +Cc: 27560, ohwoeowho, tino.calancha
[-- Attachment #1: Type: text/plain, Size: 423 bytes --]
Tino Calancha <tino.calancha@gmail.com> writes:
> The numbers above are Oleh's numbers from 2015.
Yes, but AFAIR `seq-uniq' hasn't changed since then.
> If i run similar benchmarks now i don't get such impressive
> difference between cl-lib/seq:
Indeed, I will run some benchmarks as well. In your benchmarks, cl-lib
is still much faster than seq-uniq, even if it's not as impressive as
Oleh's benchmark.
Cheers,
Nico
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#27560: 26.0.50; seq-uniq is slow
2017-07-03 13:50 ` Nicolas Petton
@ 2017-07-03 13:52 ` Nicolas Petton
2017-07-03 14:09 ` Nicolas Petton
0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Petton @ 2017-07-03 13:52 UTC (permalink / raw)
To: Tino Calancha; +Cc: 27560, ohwoeowho, tino.calancha
[-- Attachment #1: Type: text/plain, Size: 262 bytes --]
Nicolas Petton <nicolas@petton.fr> writes:
> Indeed, I will run some benchmarks as well. In your benchmarks, cl-lib
> is still much faster than seq-uniq, even if it's not as impressive as
> Oleh's benchmark.
It looks like I read the benchmark results wrong :)
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#27560: 26.0.50; seq-uniq is slow
2017-07-03 13:52 ` Nicolas Petton
@ 2017-07-03 14:09 ` Nicolas Petton
2017-07-03 14:19 ` Tino Calancha
0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Petton @ 2017-07-03 14:09 UTC (permalink / raw)
To: Tino Calancha; +Cc: 27560, tino.calancha, 27560-done, ohwoeowho
[-- Attachment #1: Type: text/plain, Size: 445 bytes --]
Nicolas Petton <nicolas@petton.fr> writes:
>> Indeed, I will run some benchmarks as well. In your benchmarks, cl-lib
>> is still much faster than seq-uniq, even if it's not as impressive as
>> Oleh's benchmark.
>
> It looks like I read the benchmark results wrong :)
seq-uniq seems to be much faster than in 2015, while its definition
basically hasn't changed. I won't investigate much further as I'm happy
with then benchmark results.
Nico
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#27560: 26.0.50; seq-uniq is slow
2017-07-03 14:09 ` Nicolas Petton
@ 2017-07-03 14:19 ` Tino Calancha
0 siblings, 0 replies; 6+ messages in thread
From: Tino Calancha @ 2017-07-03 14:19 UTC (permalink / raw)
To: Nicolas Petton; +Cc: Tino Calancha, 27560-done, ohwoeowho
On Mon, 3 Jul 2017, Nicolas Petton wrote:
> Nicolas Petton <nicolas@petton.fr> writes:
>
>>> Indeed, I will run some benchmarks as well. In your benchmarks, cl-lib
>>> is still much faster than seq-uniq, even if it's not as impressive as
>>> Oleh's benchmark.
>>
>> It looks like I read the benchmark results wrong :)
>
> seq-uniq seems to be much faster than in 2015, while its definition
> basically hasn't changed. I won't investigate much further as I'm happy
> with then benchmark results.
I am quite amazed with the 27 garbage collections that Oleh found:
> (benchmark-run (seq-uniq cands 'equal))
> (5.270219822 27 2.396615401000002)
I might get occasionally 1 gc, tipically 0: 27 demands a double checking.
Tino
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-07-03 14:19 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-03 8:20 bug#27560: 26.0.50; seq-uniq is slow Nicolas Petton
2017-07-03 13:16 ` Tino Calancha
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
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.