zsviczian / obsidian-excalidraw-plugin

A plugin to edit and view Excalidraw drawings in Obsidian
4.29k stars 233 forks source link

FR: Improvement of Startup Time #2068

Closed DocVonJ closed 1 month ago

DocVonJ commented 1 month ago

Is your feature request related to a problem? Please describe.

Obsidian start-up time breakdown

Obsidian version: v1.7.4 Installer version: v1.4.13 Operating system: Windows 10 Home 10.0.19045

zsviczian commented 1 month ago

I understand. It is, however, not a priority for me a this time. There are two reasons why Excalidraw loads slow:

GitMyCode commented 1 month ago

Hello, I m curious too about the slow startup of this plugin. Seem that they recently release a new api for plugin to take advantage of deferred https://docs.obsidian.md/Plugins/Guides/Understanding+deferred+views

zsviczian commented 1 month ago

Thanks! I've already implemented support for deferred views 1 month ago when they were published in the alpha channel. BTW, deferred views happen regardless of the plugin, its rather that the plugin needs to make sure it does not make the assumption that the view is loaded before the tab is actually active.

As said above, core of the issue is the size of the plugin... and that is because Obsidian does not support plugins deploying assets, it all must be in a single main.js.

That said, I deferred loading of fonts. As a result, 2.5.3 loads somewhat faster. On my desktop I see figures between 650ms and 1000ms. Which is a roughly 2x improvement.

Sprocketer commented 1 month ago

@zsviczian Is there any chance you could have an alternative set of several plugins on which work together to form the whole plugin? Or would it be too difficult to get different plugin files to communicate with each other like in one single JS file?

zsviczian commented 1 month ago

That is creative idea and maybe something I'll consider for the custom font sets like CJK... It is probably easier to download a second plugin then a zip file... However, I would rather the user community collectively put a bit of pressure on the Obsidian Devs to allow plugins to deploy assets instead of working on creative workarounds, as that would be the proper solution.

BTW - on my various devices Excalidraw loads in about 800ms (note I am on a newer beta version that includes some load time improvements)... I understand on lower powered machines this might be 2-3000ms. However, for me, these times are fully acceptable, I don't really see an issue that needs to be worked on.

zsviczian commented 1 month ago

It seems I can fix... :) 2.6.0-beta-4 is down to between 100ms and 200ms startup time

You can test it using BRAT. I'd love to receive some feedback if it is working for you, or if it has created issues. I've made some significant changes to achieve this thus I am concerned to publish the change without deep enough testing.

I explain how to beta test with BRAT here: https://youtu.be/2poSS-Z91lY?t=330

zsviczian commented 1 month ago

Any feedback on testing?

image

zsviczian commented 1 month ago

fixed in 2.6.0

amperag commented 4 weeks ago

Wow, I'm seeing massive speed improvements (Cold / Hot start):

So for my personal setup the Excalidraw plugin is loading 5x times faster! 🎉

Thanks a lot @zsviczian! This improvement really does make a difference!


Before (2.5.x):

Obsidian start-up time breakdown
Obsidian version: v1.7.4
Installer version: v1.6.5
Operating system: Windows 10 Pro 10.0.19045
- Total startup time: 4.251ms
- Initialization: 583ms
- Vault (2.666 files): 789ms
- Workspace (10 tabs, 8 deferred): 350ms
- Core plugins: 73ms
- Community plugins (10 active): 2.456ms
  - Excalidraw (v2.5.2): 1.607ms ⭐
  - Text Extractor (v0.5.2): 306ms
  - Omnisearch (v1.24.1): 160ms
  - Zotero Integration (v3.2.1): 132ms
  - Dataview (v0.5.67): 101ms
  - Auto Note Mover (v1.2.0): 19ms
  - Recent Files (v1.7.0): 17ms
  - Paste image rename (v1.6.1): 17ms
  - Sort & Permute lines (v0.7.0): 15ms
  - Tag Wrangler (v0.6.1): 10ms

After (2.6.x):

Obsidian start-up time breakdown

Obsidian version: v1.7.4
Installer version: v1.6.5
Operating system: Windows 10 Pro 10.0.19045

- Total startup time: 2.413ms
- Initialization: 491ms
- Vault (2.670 files): 651ms
- Workspace (10 tabs, 9 deferred): 164ms
- Core plugins: 86ms
- Community plugins (10 active): 1.021ms
  - Text Extractor (v0.5.2): 287ms
  - Excalidraw (v2.6.2): 258ms ⭐
  - Zotero Integration (v3.2.1): 139ms
  - Omnisearch (v1.25.0): 134ms
  - Dataview (v0.5.67): 97ms
  - Auto Note Mover (v1.2.0): 16ms
  - Sort & Permute lines (v0.7.0): 10ms
  - Tag Wrangler (v0.6.1): 9ms
  - Paste image rename (v1.6.1): 7ms
  - Recent Files (v1.7.0): 7ms

grafik