New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEATURE: improve performance for all `counsel-xxx-grep` commands #1198

Closed
redguardtoo opened this Issue Sep 12, 2017 · 0 comments

Comments

Projects
None yet
1 participant
@redguardtoo
Contributor

redguardtoo commented Sep 12, 2017

I understand current ivy basically converts the user input into regular expression used by grep program (the actual grep program could be ag, rg, git-grep, grep ...).

The key issue is this solution is slow when user input multiple keywords (I use git-grep, take 5 or 6 seconds to filter 5000 candidates)

I suggest a two step UI,

  • user is asked to provides a keyword to grep (that keyword cannot be undo and is invisible in ivy UI)
  • we grep the the candidates and display them in ivy window, user can input other keywords to filter the candidate (we can use pure lisp to filter the candidates).

I've tested such solution in my own my-grep (https://github.com/redguardtoo/emacs.d/blob/master/lisp/init-ivy.el). It takes less than 1 second while counsel-git-grep takes 5 seconds on refreshing candidates.

Extra benefit is occur code is simpler and much more efficient because we only run grep program once and everything else is handled by lisp.

@redguardtoo redguardtoo changed the title from improve performance for all `counsel-xxx-grep` commands to FEATURE: improve performance for all `counsel-xxx-grep` commands Sep 12, 2017

jeberger added a commit to jeberger/swiper that referenced this issue Oct 12, 2017

ivy.el: Add a small refresh delay for dynamic collections.
This is probably a good idea performance-wise since it limits the number
of collection updates when the user is typing. However, the main reason
for this change is to work around an Emacs freeze on Windows when the
dynamic collection is generated by an external command (see for example
this bug in helm-ag which also affects counsel-ag and similar commands:
syohex/emacs-helm-ag#188).

Related to abo-abo#1218 (but only applies for dynamic collections, where the
difference is really noticeable).
Helps with abo-abo#1198 and abo-abo#786.

abo-abo added a commit that referenced this issue Nov 13, 2017

ivy.el: Add a small refresh delay for dynamic collections.
This is probably a good idea performance-wise since it limits the number
of collection updates when the user is typing. However, the main reason
for this change is to work around an Emacs freeze on Windows when the
dynamic collection is generated by an external command (see for example
this bug in helm-ag which also affects counsel-ag and similar commands:
syohex/emacs-helm-ag#188).

Related to #1218 (but only applies for dynamic collections, where the
difference is really noticeable).
Helps with #1198 and #786.

Fixes #1237

@redguardtoo redguardtoo closed this Dec 4, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment