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

Laggy when loading a large bib file #63

Open
DrGo opened this issue Nov 8, 2023 · 3 comments
Open

Laggy when loading a large bib file #63

DrGo opened this issue Nov 8, 2023 · 3 comments

Comments

@DrGo
Copy link

DrGo commented Nov 8, 2023

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,

@noahares
Copy link
Collaborator

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).

@DrGo
Copy link
Author

DrGo commented Nov 15, 2023

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.

@noahares
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants