telescope-frecency.nvim icon indicating copy to clipboard operation
telescope-frecency.nvim copied to clipboard

Call `save()` asynchronously for performance

Open delphinus opened this issue 10 months ago • 4 comments

ref #130

delphinus avatar Aug 27 '23 09:08 delphinus

This is achieved by #143.

delphinus avatar Sep 17 '23 08:09 delphinus

Ah, it's incomplete. Open it.

delphinus avatar Sep 17 '23 08:09 delphinus

We should introduce the only thread to access DB (save & load) by mpsc (multi producer and single consumer model).

delphinus avatar Sep 18 '23 00:09 delphinus

luv seems to provide either a new thread we can't communicate with or a thread pool we can communicate with

so it looks like it should be addressed with an API outside of luv... perhaps a two-way communication with an unix socket?

FelipeLema avatar Oct 04 '23 14:10 FelipeLema

I tried threading (not coroutines) to separate the logic to save/load DB, but it needs rewriting almost all logic because the current code depends on plenary.async module a lot.

Instead of that, I have written code to access DB more lazily in #180. That makes it postpone DB initialization until the first time :Telescope frecency is called. And load()/save() themselves are called in a separated coroutine not to affect the main loop.

I think it is enough for this issue. Closing.

delphinus avatar Mar 21 '24 07:03 delphinus