nvim-neorg / neorg-telescope

Telescope.nvim integration for Neorg
GNU General Public License v3.0
187 stars 24 forks source link

performance problem on insert_file_link #59

Closed f4z3r closed 4 months ago

f4z3r commented 6 months ago

First and foremost, thanks a lot for your awesome work. I have now fully switched from Orgmode to Neorg and it is great!

Context

I use Neorg to manage a second brain, which contains hundreds of files. I need the management, linking, and searching to be very fast to have it be truly useful.

Issue

The insert_file_link becomes very slow once about one hundred files are reached. With my current setup, I have to wait up to 15 seconds for the Telescope overlay to appear.

Since searching files by name is quite fast, I am guessing this comes from the fact that the "alt-text" (from metadata title) is computed ahead of time to be displayed in the Telescope suggestions. I have not actually tested this, this is more of a gut feeling.

Would it be possible to add a configuration option to essentially disable the "alt-text" preview and only inject it once a file is selected for insert? That way only a single file's metadata needs to be read (the file that was selected by Telescope) instead of all files' metadata, which I would guess would massively improve performance.

benlubas commented 6 months ago

Yes, this would be possible. If you want help doing it lmk, or I can take a look. I also have the same performance issue, although it's only ~5 seconds, still very slow.

I'll note that you could use the autocomplete for file names to get around this, those don't include the header text

f4z3r commented 6 months ago

Yes I would indeed be interested in taking a look. I am not quite sure when I will have some time, but I'll try to squeeze it in next week.

I use the auto-complete as you say, but on to of the metadata title, it requires to type the brackets and colon manually. And I am lazy I guess 😅

f4z3r commented 5 months ago

Ok I got a working solution. It is indeed much faster now (near instant). I am a bit unsure how to manage the configuration nicely though. Due to how the modules are structure and how neorg manages configuration, it makes it a bit strange to pass around configuration. I will open a PR tomorrow or so.