hadynz / obsidian-sidekick

A companion to identify hidden connections that match your tags and pages
134 stars 9 forks source link

Significant lag when switching between notes #13

Closed HEmile closed 2 years ago

HEmile commented 2 years ago

(Note: I have a rather large vault) This plugin freezes Obsidian for about 10 seconds when switching between notes. Proof it is this plugin: image

I cannot see in the console exactly how large the index is, but it seems to be around 10-20 thousand. Getting this index is apparently very expensive.

hadynz commented 2 years ago

cannot see in the console exactly how large the index is, but it seems to be around 10-20 thousand.

Wowsy! 🤯

If you have a vault of this size, then for sure the current implementation won't work well.

That said, this can be improved by:

(a) building the initial index when Obsidian starts async so it does not block your editor (b) listening to Obsidian cache changes and file renames, and updating the indices that have been affected only

I'll mark this as enhancement and will prioritise as the current implementation is simple (to achieve MVP) but will not scale with users of similar vault size.

HEmile commented 2 years ago

That makes sense! It's a challenging problem to scale while keeping efficient when switching notes and tracking changes. If you need additional help or testing, let me know :)

hadynz commented 2 years ago

@HEmile I have reworked how and when indexes are built for a given Vault to optimise for performance in #16. Would greatly appreciate if you can test out the latest 1.3.0 version and if you can profile it too.

How big is your vault at the moment?

HEmile commented 2 years ago

Hey, this seems to be much much quicker! Thank you :)

image

This profile doesn't immediately strike me as being bad. Switching between nodes takes some time, but I have tonnes of plugins (in particular Breadcrumbs, Supercharged Links and Graph Analysis all take some space). So in total I think it's fine, at least for now. Will need to test more :)

hadynz commented 2 years ago

Version 1.4.1 has another performance improvement. Let me know if you notice any significant difference.

HEmile commented 2 years ago

Been playing with it a lot. Seems like in larger documents, it will not immediately highlight everything (which is good!). Doesn't seem like I'm noticing any significant slowdowns right now :) Well done!