obsidian-map-view icon indicating copy to clipboard operation
obsidian-map-view copied to clipboard

Obsidian freezes for 10-15 seconds when pressing map view

Open zeltak opened this issue 4 years ago • 32 comments

thx for the fix!

I updated to the latest version

unfortunately it seems now on my system pressing the map view freezes obsidian for a good 10-15 seconds :)

plus it seems that didn't fix the world view

as always happy to help debug!

best

Z

Originally posted by @zeltak in https://github.com/esm7/obsidian-map-view/issues/14#issuecomment-890802338

zeltak avatar Aug 02 '21 07:08 zeltak

see above comments

zeltak avatar Aug 02 '21 07:08 zeltak

  1. Are you sure you upgraded the plugin version to 0.0.9?
  2. Can you post your configuration again?
  3. Is there something showing in the development console (Ctrl+Shift+I) when you open the plugin or work with it?

esm7 avatar Aug 05 '21 08:08 esm7

Hi again

Are you sure you upgraded the plugin version to 0.0.9? image

Can you post your configuration again? sure attached data.json.zip

Is there something showing in the development console (Ctrl+Shift+I) when you open the plugin or work with it?

this time obsidian frooze completely :) here is the dev view

image

thx again

itai

zeltak avatar Aug 05 '21 11:08 zeltak

Sorry I should have been more detailed :) Under the dev view there's a "console" tab (it's at the bottom of your screenshot). Can you check if it shows anything?

esm7 avatar Aug 05 '21 12:08 esm7

No worries , happy to debug:)

here it is (this time obsidian froze for around 15 seconds):

image

zeltak avatar Aug 05 '21 12:08 zeltak

We're not as lucky this time, I'm unable to recreate it. A few more things if you don't mind...

  1. Can you try to disable all community plugins except Map View, restart Obsidian and see if this makes a difference? If so, it would be great if you can locate which plugin is interfering.
  2. After that initial freeze, if you click on a note then go back to the map, does it freeze again?
  3. You mentioned you still have the "world view" issue. Do you mean that when you click a note, then click "show on map", you get the world view rather than a zoom on the location? Does it happen with all locations?

esm7 avatar Aug 05 '21 14:08 esm7

  1. Can you try to disable all community plugins except Map View, restart Obsidian and see if this makes a difference? If so, it would be great if you can locate which plugin is interfering.

did that and still get eh freeze :D

  1. After that initial freeze, if you click on a note then go back to the map, does it freeze again?

i cant even click on a note obsidian is completely frozen

  1. You mentioned you still have the "world view" issue. Do you mean that when you click a note, then click "show on map", you get the world view rather than a zoom on the location? Does it happen with all locations?

yes exactly and yes it happens in all locations (tried 7-8 different notes and locations )

thx so much !

Z

zeltak avatar Aug 05 '21 14:08 zeltak

I just released a 0.1.0 version and added a Debug Logs toggle in the settings. Can you update, turn that on, reload the plugin, let it sit until it's done whatever it is doing, and then send me the same console output like above?

esm7 avatar Aug 05 '21 18:08 esm7

As another point of reference, I have the same problem, it freezes for about 10 seconds after it prints out the updateMapToState:

image

HEmile avatar Aug 05 '21 19:08 HEmile

I just released a 0.1.0 version and added a Debug Logs toggle in the settings. Can you update, turn that on, reload the plugin, let it sit until it's done whatever it is doing, and then send me the same console output like above?

sure :) updated , turned in the advanced debug and"

  • first time obsidian the map didn't show up and i got this error

image

  • second time obsidian just completely froze up:

image

am i doing something wrong :D

best

Z

zeltak avatar Aug 06 '21 07:08 zeltak

Thanks for the help so far! I have a suspicion of what might be going on and added more debug logs to catch it. @HEmile, @zeltak, do you mind -

  1. Unzipping the attached debug build of the plugin into VAULT/.obsidian/plugins/obsidian-map-view (make sure there's already a main.js file there before unzipping so you'll be sure you're in the right place),
  2. Doing the same thing, again with debug logs turned on? main.zip

esm7 avatar Aug 06 '21 11:08 esm7

Looks like the setState phase is very expensive:

image

HEmile avatar Aug 06 '21 12:08 HEmile

Ok I think I got it! I'm guessing from the log that Obsidian on your system doesn't like plugins to await while setting a state, regardless of the actual action (updateMapToState) not being very long. Can you try the attached fix and let me know if it solves the issue? main.zip

esm7 avatar Aug 06 '21 12:08 esm7

It's now giving this, but it's still freezing actually after updateMapToState.

image

HEmile avatar Aug 06 '21 12:08 HEmile

Hi again

i also tried it and its still freezing for me :)

image

happy to further debug

Z

zeltak avatar Aug 08 '21 13:08 zeltak

For both of you guys the performance counters are fundamentally different than mine. I made an optimization that might help and added some more specific printouts. Would appreciate another run. main.zip

esm7 avatar Aug 08 '21 14:08 esm7

sure

here is the output with the latest version you sent

Still took about 2 minutes to load and again the map is zoomed out

image

thx for looking into this!

Z

zeltak avatar Aug 09 '21 11:08 zeltak

I'm sorry for disappearing, I didn't have any time to work on this project for more than a week. This bug is my top priority, and I'll devote the little time I have in the next couple of days to getting it sorted. I suspect the freeze started in version 0.0.9, so I inspected the diff between the versions and came up with another attempt. Can you try the attached? main.zip

esm7 avatar Aug 18 '21 10:08 esm7

thx!

no worries @esm7 :)

i tried the latest it dosent see to give any errors but still the same super slow response :)

image

best

Z

zeltak avatar Aug 18 '21 11:08 zeltak

You seem to have over 1400 location markers, is this correct or the result of some parsing error? That's very possibly the key for why it doesn't recreate for me. How do these markers look like, are they mostly in separate notes or is it a few notes with many inline markers? Also, is my understanding correct that the problem started in version 0.0.9 of the plugin? If your inline locations are still backwards-compatible (you didn't convert them to the geo:... syntax), can you check if in version 0.0.8 (attached) the freeze is not there? main.zip

esm7 avatar Aug 18 '21 11:08 esm7

Hi again

1400 seems to much but i may have a few hundreds across my notes

its always in the yaml part such as

---
tags: [ nyc]
status: 5
rating: 3
location: [40.784240722656,-73.948684692383]
counter: 
---
# Pata Market

each note has a location entry (i have a few hundreds)

i don't think i ever had 0.0.8, im a neweb in obsidian :)

thx again

Z

zeltak avatar Aug 18 '21 12:08 zeltak

@HEmile was there a version upgrade that seems to have worsened the situation or was it always like that with your amount of markers? It could be "just" the inherent issue that it takes a long time to parse thousands of files and build markers for them, and caching is needed, as I'm planning anyway to do for this and this. Either way, I wrote a script that generates 1000 notes with location data and the problem now recreates, so I can investigate is there is a bottleneck that can be tackled before I'm done with caching and clusters.

esm7 avatar Aug 18 '21 12:08 esm7

After further investigation seems like parsing and creating markers for thousands of notes is actually very fast, and all the time goes to add these markers to Leaflet.js. I'll investigate if there is a faster way to batch-add markers, but it's possible that only clusters can handle these quantities.

esm7 avatar Aug 18 '21 13:08 esm7

@HEmile was there a version upgrade that seems to have worsened the situation or was it always like that with your amount of markers?

I don't think there was an earlier version that was quicker, no. Like you mention, it's more likely related to needing to either cache or with creating the markers. Like mentioned, clusters would be ideal for this! (In fact, that's a feature I'm quite missing in terms of usability too. It can look quite cluttered! I hope it's not too hard to implement...)

HEmile avatar Aug 18 '21 14:08 HEmile

It doesn't look hard at all, after fixing a few small bugs this is definitely the next thing to do. It will also greatly help make the plugin more usable on mobile.

esm7 avatar Aug 18 '21 15:08 esm7

It's finally here, marker clusters are now available on version 0.2.1, and I'm curious to know how this works for you guys with many markers!

esm7 avatar Oct 20 '21 17:10 esm7

Oh wow this is excellent! So smooth and quick :) Very amazing work!! image

HEmile avatar Oct 21 '21 08:10 HEmile

@esm7 awesome update thx so much!!

the new version dosent freeze obsidian and in general is very smooth!

the only issue still (and maybe that's not a bug) is that if you stand on a note with coordinates its still opens the globe view and not the zoomed location of the actual note, is that by design?

thx so much!

Z

zeltak avatar Oct 22 '21 06:10 zeltak

That's not supposed to happen, unless you have "Default zoom for show on map action" configured very low. What value do you have set for that setting? If that's not the issue, do you mind explaining in more detail what you're doing? What kind of location (inline / frontmatter), which "Show on map" option are you using (from the note's context menu? Right-click?) etc?

esm7 avatar Oct 25 '21 09:10 esm7

Hi i played with "Default zoom for show on map action" in both high and low and middle configuration and that didn't seem to change anything

image

the issue is that whenever i open a note with coordinates i get the global map with all pins:

image

i was under the impression that it should zoom to the actually location of the current note (ie NYC, London etc)

i will say it opens now lightning fast which is so awesome :D

happy to debug

best

Z

zeltak avatar Oct 27 '21 08:10 zeltak