nvim-telescope / telescope-frecency.nvim

A telescope.nvim extension that offers intelligent prioritization when selecting files from your editing history.
MIT License
777 stars 37 forks source link

Call `save()` asynchronously for performance #137

Closed delphinus closed 6 months ago

delphinus commented 1 year ago

ref #130

delphinus commented 1 year ago

This is achieved by #143.

delphinus commented 1 year ago

Ah, it's incomplete. Open it.

delphinus commented 1 year ago

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

FelipeLema commented 1 year ago

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?

delphinus commented 6 months ago

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.