Skip to content
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

ivy-read calls collection function on input change without dynamic-collection #2911

Open
dminuoso opened this issue Sep 5, 2021 · 1 comment
Labels
downstream Issue lies with downstream package triage

Comments

@dminuoso
Copy link

dminuoso commented Sep 5, 2021

Hi,

I'm currently chasing down a performance problem in counsel-projectile, which behaves rather sluggish on typing input inside counsel-projectile. After some debugging I found out, that ivy-read calls the collection function counsel-projectile--project-buffers-and-files each time an additional character was entered into ivy's input.

https://github.com/ericdanan/counsel-projectile/blob/06b03c1080d3ccc3fa9b9c41b1ccbcf13f058e4b/counsel-projectile.el#L1628-L1638

This is the call into ivy-read.

I'm not quite sure why that is, there's no dynamic-collection passed to ivy-read, even explicitly passing :dynamic-collection nil does not help.

Under what circumstance would ivy-read call the collection function repeatedly on input change? The documentation does not give any hint here.

@basil-conto
Copy link
Collaborator

basil-conto commented Sep 12, 2021

Completion collections that are non-dynamic-collection functions are described in the Elisp manual: (info "(elisp) Programmed Completion").

Since Ivy's whole model is an instantly-updating list of all possible completions given the current input, it's only natural that it needs to call programmed completion functions with any change in input. IIUC, it's up to the completion table to cache its results or otherwise achieve acceptable performance, and AFAICT counsel-projectile has deliberately gone down this route.

So, unless I'm missing something, this discussion seems more fitting for the counsel-projectile issue tracker, no? Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
downstream Issue lies with downstream package triage
Projects
None yet
Development

No branches or pull requests

2 participants