obsidian-image-toolkit icon indicating copy to clipboard operation
obsidian-image-toolkit copied to clipboard

First image takes a long time to open

Open gmkado opened this issue 3 years ago • 5 comments

After restarting obsidian, the first image I click on results in the application freezing for about a minute. I ran a profile on it and it appears to be hanging on a regex test, but its not clear to me why that would be the case. image

Any subsequent image clicks opens immediately without issue.

https://github.com/sissilab/obsidian-image-toolkit/blob/789c4fe62813e1c720749b0cd12c66e0aeb26971/src/util/markdowParse.ts#L132

This was not happening previously, I will try a previous version to see if that fixes the issue

gmkado avatar Aug 16 '22 21:08 gmkado

Disabling the navbar fixed the issue. I guess that makes sense if its trying to scrub all the images in my vault? Not sure if there's an easy way to paginate the navbar

gmkado avatar Aug 16 '22 21:08 gmkado

@gmkado Hi, thanks for your feedback. That would be better if you can provide the following information:

  1. the number of images in your file which you were looking through
  2. the source or markdown of images

Please provide more details, because I want to reproduce your problem. When you click an image of a file at the first time, all images will be parsed from your file that you were clicking. And the time cost of the step depends on the size of your file. After parsing successfully, the images will be cached and you can fast preview any image of the file via clicking unless you modify the content of the file.

sissilab avatar Aug 18 '22 03:08 sissilab

Hi @sissilab, I just re-enabled to check these things. There were 27 images linked from an assets folder where I keep all image files. After the initial freeze, the image preview does open quickly which agrees with what you're saying about the caching.

There were 3 other embedded items that showed up as broken links in the bottom bar. One was an embed to a block in the same page. The other two were transcluded excalidraw drawings. I took those out, and the initial load went from 45s to maybe 30s, so an improvement but still not great. I also noticed that when these items were included, switching between images in the bottom bar was very slow.

Maybe the caching can be done in the background so it doesn't freeze the entire application?

I can't provide the images since I use this for work, but let me know if there is any other info about them that would be useful.

gmkado avatar Aug 19 '22 20:08 gmkado

I also noticed that when these items were included, switching between images in the bottom bar was very slow.

Hmm disregard this comment. I added the embedded items back in and switching between images was still fast. So something else was causing the switching to be slow initially. I can't seem to recreate that.

gmkado avatar Aug 19 '22 20:08 gmkado

There were 3 other embedded items that showed up as broken links in the bottom bar. One was an embed to a block in the same page. The other two were transcluded excalidraw drawings.

Hi, @gmkado , could you please provide markdown code of those 3 items? You can remove or replace sensitive information, like ![[filename.png]]![Engelbart](https://ip:port/Engelbart.jpg).

  • One: an embed to a block in the same page
  • The other two: transcluded excalidraw drawings

sissilab avatar Aug 23 '22 08:08 sissilab