0

I use isearch all the time in Emacs but I've noticed on large org mode files it can take some time to find the first match. Is there any way to speed up isearch in a buffer?

EDIT: The most noticeable speed improvement came from setting isearch-lazy-highlight to nil. I was experiencing a noticeable delay when calling isearch to jump to text and this delay has now disappeared.

Conor
  • 1,509
  • 2
  • 20
  • 28
  • 1
    You give no real info to work with. Using any kind of search in a large buffer will be slower than in a small buffer. Without some details and focus, this question should be closed, IMO, as "*Too Broad*". FYI, Isearch itself is quite smart & efficient - it has always used a Boyer-Moore implementation, for instance. – Drew Jan 22 '15 at 18:34
  • I acknowledge that large volumes of text necessitate longer time to search. I was hoping for answers that either pointed me to turn on/off functionality in isearch that may be affecting performance (isearch-lazy-highlight is new information to me) or a package that I could install to augment isearch. Happy to accept edits to the question. – Conor Jan 22 '15 at 22:21

2 Answers2

4

One thing to keep in mind is that the longer your search pattern the quicker the search. So quickly typing a long search pattern (or even entering one by using M-e) can help if the buffer is humongous.

Another thing you can do is to turn off option isearch-lazy-highlight, so you don't make Isearch find and highlight all of the matches in the currently visible text. See also options lazy-highlight-initial-delay and lazy-highlight-interval.

More generally, consult the Isearch doc.

Drew
  • 29,895
  • 7
  • 74
  • 104
  • This gives me a noticeable speed improvement. Thank you! – Conor Jan 22 '15 at 22:33
  • 1
    Which of the two suggestions helped, in particular? That info and a description of your context might help other users (readers here). – Drew Jan 22 '15 at 22:47
  • I've specified what part of your answer was most helpful. For context I'm not sure what more to add. I was experiencing a delay when attempting to jump to the first match in large text files, now the delay has disappeared. – Conor Jan 23 '15 at 02:00
  • OK, thanks. Consider also narrowing when needed, as @phils mentioned. – Drew Jan 23 '15 at 14:40
1

If you were to Narrow the buffer to only the section(s) of interest before searching, then the search would be faster.

Whether this represents an overall time-saving or time-loss no doubt depends upon your use-cases.

phils
  • 71,335
  • 11
  • 153
  • 198