telescope-bibtex.nvim
telescope-bibtex.nvim copied to clipboard
Laggy when loading a large bib file
Thanks for the great plugin!
I noticed a few seconds lag every time I execute :Telescope bibtex
(on a Mac Studio with M1 Ultra and 128GB RAM).
My bib file is about 7.2mb large and has about 5000 entries (I like to keep all my refs in one file). I have not looked at the code, but I was expecting a few second lags while the BibTex is parsed.. My issue is that this happens every time I execute the command significantly affecting my work flow.
I am wondering if there is a way to avoid that.. perhaps by caching the parsed entries (if it is not done yet). For people who prefer to save memory, perhaps caching can be turned off using a flag?
Thanks,
There is caching going on after you call telescope-bibtex for the first time. The file is re-parsed only if there are any changes. This is checked via vim.loop.fs_stat(file).mtime.sec
so if there is any other program changing the mtime of that file, it will get re-parsed. You can check by calling :lua print(vim.loop.fs_stat('your-bib-file').mtime.sec)
a few times and see if the result changes (it is a long string of numbers, so maybe copy is somewhere).
Thanks Tom, I confirmed the file was not updated in between openings. I think it is possible that the Telescope process is inherently slow for large files.
I put together a basic plug-in that does not use Telescope and does not even parse bibtex. It just opens a window for searching a file using standard vim tools and then inserts the preceding citation key.
Yes there is some overhead going on. I wouldn't expect it to be that significant, but I also only have bib files with a hundred entries max.