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

We should use a persistent datastore for speed improvements #52

Open
briandk opened this issue Dec 14, 2016 · 3 comments
Open

We should use a persistent datastore for speed improvements #52

briandk opened this issue Dec 14, 2016 · 3 comments

Comments

@briandk
Copy link
Contributor

briandk commented Dec 14, 2016

Currently, I think any time the user triggers a citation pattern, the package re-reads and parses the entire set of bibfiles. If your bibliography happens to be large (~10,000 records), it takes several seconds just to show the autocomplete bar. During that time, the system is entirely unresponsive. And because data doesn't persist, every time a user with a large bibfile triggers a reference autocompletion it grinds the program to a halt.

I think a way around this might be to do an initial read of the bibfiles into a lightweight database like SQLite. Then, for any subsequent lookup we check whether the database is out of date. If it's not, we do the lookup right on the database, which should be very fast. And on the off chance the user has modified a bibfile during their session, then and only then would we need to rebuild the database.

@Focus Does this idea sound good to you? If so, I'm happy to start working on a pull request. Might take me a bit as I'm new to SQLite, but I think the performance benefits will make it orders of magnitude faster for citation lookups.

@Focus
Copy link
Owner

Focus commented Dec 15, 2016

I have thought about something like this. The big problem is that you have to watch the file as someone might add things using an other editor/software etc. If you think you can handle these problems then by all means give it a go.

@briandk
Copy link
Contributor Author

briandk commented Dec 15, 2016

@Focus I think we can use the npm package chokidar to watch any bibfiles for changes. And then if there's a change, we asynchronousky rebuild the SQLite database.

@briandk
Copy link
Contributor Author

briandk commented Dec 15, 2016

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