emacs-citar / citar

Emacs package to quickly find and act on bibliographic references, and edit org, markdown, and latex academic documents.
GNU General Public License v3.0
479 stars 53 forks source link

Don't throw out field data; use cache for citeproc #742

Closed bdarcus closed 1 year ago

bdarcus commented 1 year ago

Can you take a look at this @andras-simonyi @andersjohansson?

It's a simple solution to the problem we've previously discussed, and an alternative to #710. I mostly stole code from org-cite-csl-activate!

But this should:

  1. fix #702
  2. provide all the advantages of using the citar cache
  3. remove the potential limitation noted in the org-cite-csl-activate README.

The only problem I can potentially see is maybe it slows down initial loading of libraries a little, and uses a bit more memory. But I doubt it's a significant impact. And if it ever were, we could always add a defcustom so people could turn it off?

@andras-simonyi - not sure what you think about this, but one possibility is you can use the functions here instead, since you're already loading citar when available, and remove some code in org-cite-csl-activate in the process?

cc @benthamite

bdarcus commented 1 year ago

I can't see any downside to this, so have merged it!

andersjohansson commented 1 year ago

Got to this now and it seems to work well in my initial testing!

About performance: For my 3.7 MiB json library file (exported from Zotero with BBT) I get very similar parsing times (4.5 s) when comparing before (97092df) and after (cb7d511) this change. I suppose this is reasonable since the parsing is the same only that some fields were discarded. memory-report gives 10 MiB versus 14 MiB for citar-cache--bibliographies. No big deal.

bdarcus commented 1 year ago

Great; thanks for the data!

BTW, you may also be interested in https://github.com/emacs-citar/citar/commit/82fdbae3c1060e4e1e13347e8635d436389378fd.