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

[BUG] Very slow load of flashcard modal (since 1.11.2) #914

Closed
bgreenawald opened this issue Mar 22, 2024 · 29 comments · Fixed by #926
Closed

[BUG] Very slow load of flashcard modal (since 1.11.2) #914

bgreenawald opened this issue Mar 22, 2024 · 29 comments · Fixed by #926
Labels
bug Something isn't working

Comments

@bgreenawald
Copy link

Describe the bug
Extremely sluggish performance when loading the flashcard review modal. I will click the "Review Flashcards" button and nothing will happen. After ~30 seconds, the review flashcards modal will finally pop up. The issue occurs on the most recent versions of the plugin on both Windows Desktop and Android. This seems related either to the most recent plugin version or the most recent Obsidian version as 2 days ago things were working fine.

Versions (please complete the following information):

  • OS: Windows 11, Android
  • Obsidian version: 1.5.11
  • Plugin version: 1.12.1
  • If on desktop, Installer version: 1.4.13
@bgreenawald bgreenawald added the bug Something isn't working label Mar 22, 2024
@jharst
Copy link

jharst commented Mar 23, 2024

I'm experiencing the same issue on a MacBook Pro (MacOS 13.04.1) after the most recent update.
Versions:

  • OS: Catalina 13.04.1
  • Obsidian version: 1.5.11
  • Plugin Version: 1.12.1
  • Installer version: 1.4.14

What is more, on my iPhone the flashcard review modal won't show up at all.

Versions:

  • iOS 17.4.1
  • Obsidian: 1.5.11
  • Plugin version: 1.12.1

@19031988
Copy link

I have the same issue.

OS: Windows 10, Android 13
Obsidian version: 1.5.11
Plugin version: 1.12.1
If on desktop, Installer version: 1.5.11

@ronzulu
Copy link
Collaborator

ronzulu commented Mar 27, 2024

I've always experienced times when there are very slow load times, i.e. prior to recent upgrades of either Obsidian or the plugin.

I haven't paid too much attention, but I'm quite sure this has happened for either:

  • When plugin first loads
  • When showing the flashcard review deck selection tree

Sometimes with load times probably of the order of 30 seconds.

When the plugin first loads, or when opening the flashcard review deck selection tree, the plugin iterates through every note in the vault to find flashcards. This overall process hasn't changed.

If you turn on logging, the actual load times will be available through the chrome debugger tools (ctrl-shift-i)

image

My vault has about 3000 markdown files, load times on Windows 10 Desktop using 1.12.1 are:

image

@bgreenawald
Copy link
Author

I turned on logging and tested a few loads using the previous and current versions of the plugin, both with the current version of Obsidian. This was on my Windows 11 PC.

Plugin Version 1.11.2

  1. SR: Sync took 1496ms
  2. SR: Sync took 1123ms
  3. SR: Sync took 1080ms

Plugin Version 1.12.2

  1. SR: Sync took 22449ms
  2. SR: Sync took 23439ms
  3. SR: Sync took 21797ms

@ronzulu
Copy link
Collaborator

ronzulu commented Mar 29, 2024

Thanks @bgreenawald for summarizing that so clearly.

I'll look into it in the next few days...

@19031988
Copy link

I turned on logging and tested a few loads using the previous and current versions of the plugin, both with the current version of Obsidian. This was on my Windows 11 PC.

Plugin Version 1.11.2

  1. SR: Sync took 1496ms
  2. SR: Sync took 1123ms
  3. SR: Sync took 1080ms

Plugin Version 1.12.2

  1. SR: Sync took 22449ms
  2. SR: Sync took 23439ms
  3. SR: Sync took 21797ms

dear @bgreenawald, could You explain how to switch the plugin to old version?

@bgreenawald
Copy link
Author

@19031988 I used the BRAT plugin (https://github.com/TfTHacker/obsidian42-brat) which lets you load plugins from Github and pointed it to the 1.11.2 release.

@ronzulu
Copy link
Collaborator

ronzulu commented Mar 29, 2024

Hi there

To implement enhancements for 1.12, I needed to make use of a different Obsidian API for obtaining tags. This likely is the cause of the slow down.

I have reverted the code to use the API that was originally used, but because I personally didn't experience the slow down, I can't test myself.

Could you please try...

There is a file called main.js in this zip file
main_914A.zip

You will need to copy that to the obsidian plug-in folder, e.g.
D:\Obsidian\.obsidian\plugins\obsidian-spaced-repetition

Then reload the plug-in, or restart obsidian.

There is some extra debug. This might give a clue about the reason for our different experiences.

image

Ronny

@19031988
Copy link

dear @ronzulu . I used a file from your zip.
But the behavior of my application has not changed:

  • note tree loading is very slow when Obsidian is first started too;
  • command showing the next note to repeat freezes on the PC;
  • the same command showing the next note to repeat does not work at all on Android.

@ronzulu
Copy link
Collaborator

ronzulu commented Mar 30, 2024

Hi @19031988 thanks for trying that out

Could you please send through a screenshot from the developer console.

  • Restart Obsidian
  • Within Obsidian press Ctrl-Shift-I - the developer tools should appear
  • click on "console" and
  • take a screenshot - I'm after everything

image

Thanks
Ronny

@19031988
Copy link

dear @ronzulu here You are
image

@ronzulu
Copy link
Collaborator

ronzulu commented Mar 30, 2024

Dear @19031988

Sorry, I forgot to mention one thing.

Before taking the screenshot, wait for the status bar to display the plugin's info:
image

Then after that, click on the flashcard icon, and wait for the flashcard tree to be displayed.

Then take the screenshot like you did earlier.

And happy birthday for a couple of weeks ago :-)

Cheers
Ronny

@19031988
Copy link

dear @ronzulu here You are again. And the greatest thanks for happy-birthday-words )
image

@bgreenawald
Copy link
Author

I'm getting similar results with the new beta. See screenshot below (this is all I could capture in a single screenshot but nothing else in the console seemed particularly relevant):

image

@ronzulu
Copy link
Collaborator

ronzulu commented Apr 4, 2024

Hi again

I've come up with a new version which logs quite detailed timing info. It doesn't fix the problem, but hopefully will give me enough info to identify the problem.

Could you please try this out:
main_914D.zip

After restarting Obsidian (or reloading the plugin), wait for the initial load to complete, i.e. when the status bar shows the plugin info:
image

From the developer console, you should see something like:
image

IMPORTANT: Click on "show more..."
image

Because there is so much info, save the log to a file, right-click:
image

And post the file to me.

Also please take a screenshot of the end part of the log - should include something like the info in the highlighted area below:
image

Cheers
Ronny

@19031988
Copy link

19031988 commented Apr 6, 2024

@ronzulu here you are. Great that you don't give up)
obsidian.md-1712426543860.log

@ronzulu
Copy link
Collaborator

ronzulu commented Apr 7, 2024

Hi @19031988 thanks for that (and the encouragement)

I've updated main.js in the post above (now main_914C.zip), and added a note regarding clicking on "show more..."

If you could please try the new version with extra logging, and post the log file, that would be appreciated.

Cheers
Ronny

@19031988
Copy link

19031988 commented Apr 7, 2024

@ronzulu here you are the updated log. It is exciting how is deep this rabbit hole )
obsidian.md-1712489190423.log

@jharst
Copy link

jharst commented Apr 7, 2024

Hi @ronzulu

For what it's worth, I also attach a log of the plugin's performance on my system. I do appreciate your looking into this issue!

Cheers
Joachim
obsidian.md-1712489672963.log

@ronzulu
Copy link
Collaborator

ronzulu commented Apr 7, 2024

Hi @19031988

Thanks for that. for some reason the last few lines from the log wasn't saved (the highlighted lines shown below).

If you still have that session open, a screenshot would be great:
image

Otherwise, please go through the process again, save the log and take a screenshot of the last page of the debug outlook.

The log file and screenshot must be from the same session.

Thanks
Ronny

@ronzulu
Copy link
Collaborator

ronzulu commented Apr 7, 2024

Hi @jharst , thanks for sending that through.

Strange though - it seems to be with an older version. Can you please redo with the main_914C.zip above.

In the log it should say "C3":
image

Also, please take a screenshot (same as for @19031988 in the previous post).

Cheers
Ronny

@jharst
Copy link

jharst commented Apr 7, 2024

I'm sorry I missed the new version. Here is my log and a screenshot as requested!

obsidian.md-1712491719594.log

image

@ronzulu
Copy link
Collaborator

ronzulu commented Apr 7, 2024

Thanks @jharst @19031988

I think I've fixed the issue, could you please try:
main_914D.zip

If this hasn't worked, please send through the log file again.

Cheers
Ronny

@jharst
Copy link

jharst commented Apr 7, 2024

Hi, Thanks again – this works very well for me and the load time is considerably shorter!

@19031988
Copy link

19031988 commented Apr 7, 2024

dear @ronzulu ! Big yes it works!
And as you may be remember on old version showing random note didn't work on my mobile.
And I tested this your D-version on mobile, and it works! Great thanks!
You plugin is base, is fundamental instrument of my approach in job. With these freezes i was sad, so i am glad like shining toad now! )

@ronzulu ronzulu changed the title [BUG] Very slow initial load [BUG] Very slow load of flashcard modal (since 1.11.2) Apr 7, 2024
@ronzulu
Copy link
Collaborator

ronzulu commented Apr 7, 2024

Great, thanks @jharst @19031988 for all the back and forth diagnosing this!

@bgreenawald are you able to give this a test? Would be good if you can before I put in the PR.

@bgreenawald
Copy link
Author

Hey @ronzulu

Unfortunately, my computer isn't letting me download the latest beta for some reason. It's triggering my anti-virus and completely blocking the download (I've never seen it do this before and don't know how to fix it). If you can upload the raw main.js file, I can give that a try.

Best,
Ben

@ronzulu
Copy link
Collaborator

ronzulu commented Apr 8, 2024

Hi @bgreenawald Unfortunately GitHub won't late me upload a JavaScript file...

So I've put the zip file on dropbox, hopefully you can download:
https://www.dropbox.com/scl/fi/2dbi1v9mcnxxfglz20w04/main_914D.zip?rlkey=wskn5aewbi9594h9qljv0wh7f&dl=0

Cheers
Ronny

@bgreenawald
Copy link
Author

The newest beta has ~5-second load times for me. Seems like the issue is largely resolved.

Best,
Ben

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