zotero-better-bibtex icon indicating copy to clipboard operation
zotero-better-bibtex copied to clipboard

BBT export renders zotero v laggy and even unresponsive

Open kzssc opened this issue 1 year ago • 20 comments

Debug log ID

QJMQH2PR-euc/6.7.122-7

What happened?

basically what the subject says, what's also indicative is the power consumption ramps up to 3,000s (versus <100 when BBT is not exporting) as reported here: https://github.com/retorquere/zotero-better-bibtex/issues/2522#issuecomment-1745780408

https://i.imgur.com/MtCXgK9.png

BTT: 6.7.122 7.0.0-beta.43+f803c0cc4 M1 13.6

kzssc avatar Oct 04 '23 21:10 kzssc

Is this an auto-export or a manual export?

retorquere avatar Oct 05 '23 12:10 retorquere

This one is manual, but auto export also runs into this.

kzssc avatar Oct 05 '23 16:10 kzssc

A debug log will drop here shortly; can you install that, then go into the preferences and click Export now for one auto-export, let it finish, then click Export now again for the same auto-export, let it finish, and then send a new debug log.

retorquere avatar Oct 06 '23 12:10 retorquere

:robot: this is your friendly neighborhood build bot announcing test build 6.7.122.2667.5171 ("logging")

Install in Zotero by downloading test build 6.7.122.2667.5171, opening the Zotero "Tools" menu, selecting "Add-ons", open the gear menu in the top right, and select "Install Add-on From File...".

github-actions[bot] avatar Oct 06 '23 12:10 github-actions[bot]

4SNJ4PBS-euc/6.7.122.2667.5171-7 hope this helps!

kzssc avatar Oct 06 '23 16:10 kzssc

A new build will drop shortly, can you do the same procedure again please?

Part of the problem is that BBT drops its caches when you upgrade Zotero, and at least between QJMQH2PR-euc/6.7.122-7 and 4SNJ4PBS-euc/6.7.122.2667.5171-7 you did upgrade. That will make the first of the two very slow, but the 2nd (and following) should be substantially faster. The new build will tell.

retorquere avatar Oct 07 '23 09:10 retorquere

:robot: this is your friendly neighborhood build bot announcing test build 6.7.122.2667.5174 ("more logging")

Install in Zotero by downloading test build 6.7.122.2667.5174, opening the Zotero "Tools" menu, selecting "Add-ons", open the gear menu in the top right, and select "Install Add-on From File...".

github-actions[bot] avatar Oct 07 '23 09:10 github-actions[bot]

Thanks for the quick actions and the insights! Will test it out.

In hindsight I'm less concerned about the need for cache rebuild but more on how much system resources it's using which renders Zotero practically unusable...perhaps de-prioritising it on CPU usage?

kzssc avatar Oct 07 '23 10:10 kzssc

The cache use has a direct influence here. A filled cache makes BBT much more efficient.

I can't really influence the CPU priority. If you want to I can explain how zotero translators work but the bottom line is that you need to have a filled cache to have a 10k+ export be tolerable qua performance impact.

retorquere avatar Oct 07 '23 11:10 retorquere

VSE847TS-euc/6.7.122.2667.5174-7 here you have it :))

kzssc avatar Oct 07 '23 12:10 kzssc

Blegh, the bulk of the time is spent in prep, and prep is what hinders the UI responsivity. I have been planning a solution for this but it's going to be quite a bit of work. Worth it but it might take me a few weeks to get this working.

retorquere avatar Oct 07 '23 19:10 retorquere

perhaps a related issue: when BBT is enabled - with auto-export turned off - adding new attachment files to zotero (via new built-in function) also renders UI very slow. Disabling BBT then, file import does not incur UI lag.

My guess is that citekey generation and association might be the cause of high CPU usage? Which diagnosis code should I attach, zotero's or BBT's?

kzssc avatar Oct 19 '23 10:10 kzssc

It's not key generation. No work is done for attachments as they don't get keys.

Which diagnosis code should I attach, zotero's or BBT's?

Always BBTs. I cannot access Zotero debug logs.

retorquere avatar Oct 19 '23 10:10 retorquere

Here you go 😃 : SGCT6TJW-euc/6.7.130-7

kzssc avatar Oct 20 '23 06:10 kzssc

There's another bug I must address first, but I'm in the middle of a restructuring that should lead to improvements for the problem you're facing. That will unfortunately take me about a week to get done, so it will go silent here for a bit.

retorquere avatar Oct 20 '23 11:10 retorquere

Just wanted to add that I had auto export turned on and any modification to the library caused the UI to hang for 20-40 seconds. I disabled the automatic exports for now. Happy to submit logs if helpful.

Thanks!

daeh avatar Nov 02 '23 07:11 daeh

Already working on it.

retorquere avatar Nov 02 '23 10:11 retorquere

A minor update on this: I suspect that even with auto-export off - whenever Zotero syncs - this happens. So just to confirm: the sluggishness happens on two occasions: 1. when zotero syncs and 2. when bbt exports. Though I can't quite replicate the problem with 1 as it doesn't always happen.

Initially I suspected that's a Z7 bug (posted here: https://forums.zotero.org/discussion/109954/z7-sluggish-ui-due-to-sync#latest) but once I disabled BBT, UI works normally.

kzssc avatar Dec 06 '23 17:12 kzssc

I am not sure whether the following is a remedy for current issue or request for permanent function:

In auto-export, could an option of "auto-exporting with zotero launch" be created?

The current options for auto-export are a bit too frequent, I think. Another thing is I'm not entirely sure the mechanism for "When Idle": auto-export seems to kick-off even when I'm interacting with Zotero.

Many thanks as always, @retorquere !

kzssc avatar Mar 03 '24 17:03 kzssc

I'm working on a fix for the sluggishness. I don't see real value in "at launch", and it would be hard to get it to be both reliable and performant, but if "when idle" misbehaves for you, you can open a new issue for that and I'll look into it.

retorquere avatar Mar 03 '24 18:03 retorquere

The fix is ready; the work is being tracked/tested on #2315, but it's going into the next release.

retorquere avatar Jul 28 '24 17:07 retorquere