chrisgrieser / alfred-bibtex-citation-picker

Picker for markdown-based citations and lightweight reference manager for BibTeX libraries.
MIT License
145 stars 8 forks source link

[Bug]: Paste Full Bibliography Wait #37

Closed kzssc closed 1 year ago

kzssc commented 1 year ago

Bug Description

  1. Full Bibliography Paste takes a bit long, albeit works without issue upon wait.

  2. Followed Chris's advice here to update my pandoc (now ver. 3.1.5) there has been a small decrease in waiting time, from 5-6s to ~4s, I think.

  3. relevance unsure: my library contains over 10k entries

Relevant Screenshot

No response

To Reproduce

No response

Debugging Log

Upon inspecting the debug log a notice that I lot of entries I have doesn't contain URL, I am not sure this is relevant factor the explains the delay as these log were generated when SCP is triggered, *before* anything is typed in. 

I think the only relevant section within the log is: 

[7:49:52.725 am] Supercharged Citation Picker[Script Filter] Processing complete
[7:49:52.808 am] Supercharged Citation Picker[Script Filter] Passing output 'gilabert2023HumanDignitySocial' to Run Script
[7:49:59.368 am] Logging Stopped.

Though, the "logging stopped" was my manual action, not a reflection of the time needed to paste full bibliography.

Sample BibTeX Entries

@article{1987FacialDiscriminationExtending,
  title = {Facial {{Discrimination}}: {{Extending Handicap Law}} to {{Employment Discrimination}} on the {{Basis}} of {{Physical Appearance}}},
  shorttitle = {Facial {{Discrimination}}},
  date = {1987},
  journaltitle = {Harvard Law Review},
  volume = {100},
  number = {8},
  eprint = {1341199},
  eprinttype = {jstor},
  pages = {2035--2052},
  publisher = {{The Harvard Law Review Association}},
  issn = {0017-811X},
  url = {https://www.jstor.org/stable/1341199},
  urldate = {2022-02-20},
  file = {/Users/vpchris/Zotero/storage/KPE5NJHC/1987 Facial Discrimination - Extending Handicap Law to Employment Discrimination on.pdf;/Users/vpchris/Zotero/storage/MBW4KWMU/1987 Facial Discrimination - Extending Handicap Law to Employment Discrimination on.skim}
}

@book{1992SelfEmploymentPrograms,
  title = {Self {{Employment Programs}} for {{Unemployed Workers}}},
  date = {1992},
  publisher = {{U.S. Dept. of Labor, Employment and Training Administration, Unemployment Insurance Service}},
  location = {{Washington, D.C.}},
  langid = {english},
  annotation = {OCLC: 30034279},
  file = {/Users/vpchris/Zotero/storage/J8X8KID2/Wandner et al 1992 Self Employment Programs for Unemployed Workers.pdf}
}

@article{2000ResourcesLiberalEquality,
  title = {The {{Resources}} of {{Liberal Equality}}},
  date = {2000},
  journaltitle = {Imprints},
  volume = {5},
  pages = {63--82},
  url = {http://www2.warwick.ac.uk/fac/soc/pais/people/clayton/research/theresources_/rle.pdf},
  file = {/Users/vpchris/Zotero/storage/5Z47S47V/2000 The Resources of Liberal Equality.pdf}
}

@book{2002RightSelfEmployment,
  title = {Right to {{Self Employment Bill}}},
  date = {2002},
  publisher = {{House of Parliament, Great Britain}},
  isbn = {978-0-215-70097-1},
  langid = {english},
  keywords = {5th⭐},
  annotation = {OCLC: 1116137684},
  file = {/Users/vpchris/Zotero/storage/7JL54C5T/Great Britain et al 2002 Right to Self Employment Bill.pdf}
}

Buffer Files

untitled folder 2.zip

Workflow Configuration

image

Checklist

chrisgrieser commented 1 year ago

Hmm, can't see anything out of the ordinary here.

Do you maybe have an old device, or low free RAM? If it is the latter, a restart of your mac might help.

If you use pandoc normally to convert a markdown file with citations, how long does that take?

chrisgrieser commented 1 year ago

Also could you attach a full debugging log? That could help pinpoint where the bottleneck might be

kzssc commented 1 year ago

[7:49:46.452 am] Logging Started... [7:49:49.001 am] Supercharged Citation Picker[Hotkey] Processing complete [7:49:49.012 am] Supercharged Citation Picker[Hotkey] Passing output '' to Script Filter [7:49:49.037 am] Supercharged Citation Picker[Script Filter] Queuing argument '(null)' [7:49:49.196 am] Supercharged Citation Picker[Script Filter] Script with argv '(null)' finished [7:49:49.204 am] Supercharged Citation Picker[Script Filter] [truncated] [7:49:52.725 am] Supercharged Citation Picker[Script Filter] Processing complete [7:49:52.808 am] Supercharged Citation Picker[Script Filter] Passing output 'gilabert2023HumanDignitySocial' to Run Script [7:49:59.368 am] Logging Stopped.

edit: shortened by @chrisgrieser since only the timestamps matter

kzssc commented 1 year ago

Hmm, can't see anything out of the ordinary here.

Do you maybe have an old device, or low free RAM? If it is the latter, a restart of your mac might help.

M1 8G ram here.

If you use pandoc normally to convert a markdown file with citations, how long does that take?

The pandoc conversion to .docx is instant (contains multiple references), much quicker than the Paste.

chrisgrieser commented 1 year ago

Hmmm, not sure what could be the bottleneck here if your device is an M1 and pandoc is otherwise instant.

So measured it, and for me, the bibliography-pasting took 800ms, also on an M1 mac. I improved the code, now it takes only 350ms for me. Could you try version 11.6.3?


If it still takes a lot of time:

  1. I also changed something which should allow for better time measurement on your end, so could attach a new debugging log?
  2. could you run the following code which measures the performance of your local pandoc with a configuration similar to that of this workflow?

insert the path to your bibtex library, and then copypaste this snippet into your terminal and press enter. it should give some numbers as output how long this command took.

LIBRARY="$HOME/.config/pandoc/main-bibliography.bib"

CITEKEY="gilabert2023HumanDignitySocial"
DUMMYDOC="---
nocite: '@$CITEKEY'
---"
time echo "$DUMMYDOC" |
    pandoc --citeproc --wrap=none --read=markdown --write=plain --bibliography="$LIBRARY"
kzssc commented 1 year ago

much quicker!!

[2:08:17.888 pm] Supercharged Citation Picker[Script Filter] Processing complete [2:08:17.960 pm] Supercharged Citation Picker[Script Filter] Passing output 'gilabert2023HumanDignitySocial' to Run Script [2:08:19.885 pm] Supercharged Citation Picker[Run Script] Processing complete [2:08:19.898 pm] Supercharged Citation Picker[Run Script] Passing output 'Gilabert, P. (2023). Human Dignity and Social Justice. OUP Oxford.' to Copy to Clipboard

chrisgrieser commented 1 year ago

Hmm, it still takes way longer than on my device though (2000ms vs 350ms) 🤔

But well, guess it's now at least quick enough to work properly with?