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

Very slow to read Excalibrain and Excalidraw files #439

Closed
lsolesen opened this issue Aug 13, 2023 · 9 comments · Fixed by #289
Closed

Very slow to read Excalibrain and Excalidraw files #439

lsolesen opened this issue Aug 13, 2023 · 9 comments · Fixed by #289
Labels
bug Something isn't working

Comments

@lsolesen
Copy link

lsolesen commented Aug 13, 2023

The plugin is very slow to read Excalibrain and Excalidraw files by @zsviczian.

I am using the following regex to look for Anki-cards:

- Basic: `^Q: ((?:.+\n)*)\n*A: (.+(?:\n(?:^.{1,3}$|^.{4}(?<!<!--).*))*)`
- Cloze: `((?:.+\n)*(?:.*\{\{[^\{\}]*::[^\{\}]*\}\}.*)(?:\n(?:^.{1,3}$|^.{4}(?<!<!--).*))*)

Is there some kind of workaround, as Obsidian is not responding while waiting for the very long process - and completely stalling on some of the Excalibrain files needing to shutdown Obsidian from the task manager - and no cards are being written to Anki?

Removing Excalibrain files solves the issue.

@lsolesen lsolesen changed the title Very slow to read Excalibrain files Very slow to read Excalibrain and Excalidraw files Aug 13, 2023
@zsviczian
Copy link

Try turning on compressed mode in Excalidraw settings. It will convert the Excalidraw file into a base64 string chopped into short paragraphs. I originally introduced this feature to speed up obsidian search, maybe it will solve this problem as well.

@lsolesen
Copy link
Author

I did two things to speed up.

  1. Following @zsviczian turned on the compressed mode.
  2. More importantly it was especially stalling on a drawing where I used the free drawing tool to make background colors on certain elements. Instead I turned on the script 'Set background color of unclosed line object by adding a shadow clone' and redid the image.

Now the Obsidian_to_Anki sync managed to finish.

@zsviczian
Copy link

Note that compressed mode will only compress files you open/create/modify after turning on this setting, it won't batch compress all your earlier files in the vault.

@niposch
Copy link
Contributor

niposch commented Nov 14, 2023

related #288 and #289 for a potential fix by simply avoiding scanning excalidraw files.

@lsolesen
Copy link
Author

Retried again today and now it stalls on the Icon Library.excalidraw suggested by @zsviczian:

From the console window

Scanning  Files/Icon Library.excalidraw.md as it's changed or new.

For the file the attached code is used.
Icon Library.excalidraw.md

@niposch
Copy link
Contributor

niposch commented Nov 25, 2023

@lsolesen

Retried again today and now it stalls on the Icon Library.excalidraw suggested by @zsviczian:

From the console window

Scanning  Files/Icon Library.excalidraw.md as it's changed or new.

For the file the attached code is used. Icon Library.excalidraw.md

I added an ignore setting that allows you to ignore excalidraw files myself.
It's still broken on the official release of this plugin as my PR #289 hasn't been resolved.
You can try out the ignore setting I added by installing the prerelease I made. https://github.com/niposch/Obsidian_to_Anki/releases/tag/3.5.0_prerelease2

@lsolesen
Copy link
Author

@niposch Tried out using it, but got the following when not adding anything to the ignore filter.

plugin:obsidian-to-anki-plugin:54170 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading '0')
    at multimatch (plugin:obsidian-to-anki-plugin:54170:15)
    at FileManager.findFilesThatAreNotIgnored (plugin:obsidian-to-anki-plugin:54210:24)
    at new FileManager (plugin:obsidian-to-anki-plugin:54200:27)
    at MyPlugin.scanVault (plugin:obsidian-to-anki-plugin:54577:25)
    at async HTMLDivElement.eval (plugin:obsidian-to-anki-plugin:54615:13)

@niposch
Copy link
Contributor

niposch commented Nov 25, 2023

@lsolesen thanks for the stack trace. I found and fixed the issue. I didn't correctly handle it when the setting wasn't initialized.
Has been fixed in the latest prerelease https://github.com/niposch/Obsidian_to_Anki/releases

@ShootingKing-AM
Copy link
Member

Maybe be we can limit the size of files that are being scanning by some setting by default?

@ShootingKing-AM ShootingKing-AM added the bug Something isn't working label Jan 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants