zotero / citeproc-rs

CSL processor in Rust.
https://cormacrelf.github.io/citeproc-wasm-demo/
Other
75 stars 11 forks source link

Make reference libraries more efficient #10

Closed cormacrelf closed 5 years ago

cormacrelf commented 5 years ago

Currently, if you want a reference to be citable, you must have already added it via set_references. This is not ideal e.g. for Zotero, where there may be thousands of references, and serializing all of them to JSON once at startup, and keeping the processor updated each time one of them changes (ser the single changed ref), is too much. It probably needs to emulate citeproc-js' sys API here, where you call into JS when a reference is not found.

The following PR over at salsa may help avoid calling this for every cite, every time -- Zotero would simply notify citeproc-rs that it should invalidate one of its references, and maybe get a callback later if that item is cited.

https://github.com/salsa-rs/salsa/pull/194/files#diff-08c6e038e5b8a9cfe78f8df09fd08dc1

cormacrelf commented 5 years ago

This is unnecessary. Clients can simply keep track of which references are being used in a document (which they know, having passed in all the clusters), and subscribe to only those.