abo-abo / swiper

Ivy - a generic completion frontend for Emacs, Swiper - isearch with an overview, and more. Oh, man!
https://oremacs.com/swiper/
2.27k stars 337 forks source link

counsel-yank-pop is very slow #3040

Closed a13 closed 2 months ago

a13 commented 3 months ago

My (emacs-uptime) is 80 days so far and kill-ring has 10k elements in it. The default (benchmark-run (counsel--yank-pop-kills)) runs in 14s, mostly because of two reasons:

Could you provide the way to customize the way we compare elements in kill-ring or to remove the usage equal-including-properties completely (this way we can use delete-dups or seq-uniq).

Thanks.

basil-conto commented 3 months ago

kill-ring has 10k elements in it.

Is that an explicit choice on your part, by customising kill-ring-max? Or does your kill-ring somehow grow beyond kill-ring-max elements?

Could you provide the way to customize the way we compare elements in kill-ring or to remove the usage equal-including-properties completely (this way we can use delete-dups or seq-uniq).

This should be doable, but note that this would diverge from the built-in behaviour: kill-new uses equal-including-properties when the user option kill-do-not-save-duplicates is non-nil.

Another option would be to deduplicate in counsel-yank-pop only when the user option kill-do-not-save-duplicates is non-nil. But this might confuse users who are used to the current behaviour of unconditionally deduplicating.

a13 commented 2 months ago

Is that an explicit choice on your part, by customising kill-ring-max?

correct

Another option would be to deduplicate in counsel-yank-pop only when the user option kill-do-not-save-duplicates is non-nil.

it's still an option, yes. But consult for example, just ignores properties.

basil-conto commented 2 months ago

Which Emacs version are you on? If you're on 28 or newer, I think PR #3045 should improve performance. If you can test it before I merge, that would be great; otherwise I'll merge it later this week and everyone can become a tester :).