abo-abo / swiper

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

swiper-isearch-backward very slow #2864

Closed dionisos2 closed 3 years ago

dionisos2 commented 3 years ago

Hi, When I call swiper-isearch on a 600k text file it is quick, but when I call swiper-isearch-backward at the end of the same file, it is very slow. (I tested it with "make plain")

basil-conto commented 3 years ago

Thanks, I see the same pathological behaviour due to excessive garbage collection.

I don't use swiper-isearch or swiper-isearch-backward, so could you please check whether #2865 is still correct and avoids the massive slowdown?

Backward search will always be slower in Emacs, and I'm sure that swiper-isearch-backward can be overhauled to improve its performance, but hopefully that PR will make it more bearable in large files.

dionisos2 commented 3 years ago

Wow this was quick, thank you ! Everything seem to work fine with your commit.

I hope it is ok to ask an unrelated question, but what do you use instead of swiper-isearch ? (I am surprised because I was expecting swiper developers to use swiper for it)

basil-conto commented 3 years ago

Everything seem to work fine with your commit.

Great, thanks for confirming! I'll merge that PR shortly.

but what do you use instead of swiper-isearch ?

I use vanilla isearch most of the time (with isearch-lazy-highlight and isearch-lazy-count turned on), and occasionally swiper (see below).

(I am surprised because I was expecting swiper developers to use swiper for it)

Well, I'm not responsible for either swiper or swiper-isearch, or any of Ivy's design in general. I'm mostly here to help around if I can because my config has relied on Ivy for several years now, particularly the ivy--regex-ignore-order completion style and the counsel library.


Off-topic personal history:

When I started using Ivy there weren't many other viable alternatives, and as a relatively fresh Emacs user I liked all the bells and whistles that came with swiper, so I used that as my default search. Since then, as I've gained more Emacs experience, I've come to prefer general built-in solutions wherever possible, or at least solutions that integrate more closely with Emacs internals.

Nowadays there are many new packages that integrate more closely with built-in Emacs infrastructure, but I haven't had the time to look into them yet. I'm also fortunate to use the development version of Emacs as my daily driver and hang around the Emacs mailing lists, so I can immediately make use of the latest built-in features (there seems to be more interest lately in improving the completion system).

I still keep the swiper key binding around because occasionally I want (or at least my muscle memory wants) the nice overview with ivy--regex-ignore-order. Together with the latest isearch.el, project.el, and xref.el features this covers all my needs, so I haven't really felt a compelling use case for swiper-isearch.

basil-conto commented 3 years ago

I'll merge that PR shortly.

Done and pushed to GNU-devel ELPA, which should be updated within a few hours: https://elpa.gnu.org/devel/swiper.html