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

Dataview table loading speed is getting slow #1226

Open
Missionary-OSBS opened this issue Jun 30, 2022 · 12 comments
Open

Dataview table loading speed is getting slow #1226

Missionary-OSBS opened this issue Jun 30, 2022 · 12 comments
Assignees
Labels
bug Something isn't working.

Comments

@Missionary-OSBS
Copy link

Missionary-OSBS commented Jun 30, 2022

What happened?

The loading speed on a page with a lot of dataview table contents is getting slow.
image

  • In each of these files, I embedded an image link
    image

My question is if I exchange the image link to save image locally, will it boost up the loading speed to refresh the page ?
_ I've already tried on a small scale dataview and it does boost up the loading speed of the local images but the rest of the column in dataview table still getting slow to refresh.

DQL

table image as 🏞, year as 🗓, rating as 🏆, complexity as 🎯, player as 👥, genre as 🎮, price as 💵, purchase_date as ✈️, arrive_date as 📦, ks as KS, expansion as 🧰, link as 🌐
from #BG/purchased  
sort arrive_date desc

JS

No response

Dataview Version

0.5.38

Obsidian Version

0.15.3

OS

MacOS

@Missionary-OSBS Missionary-OSBS added the bug Something isn't working. label Jun 30, 2022
@blacksmithgu
Copy link
Owner

What part of the page is slow to load? Is it the entire table takes several seconds to load, or parts of it load and then other stuff fills in?

@Missionary-OSBS
Copy link
Author

The parts of it load and other stuff takes several seconds to load, especially when I embedded multiple dataview tables into a single page. So if I click on that page and click on other file, it would take seconds to fully load the page before it can response to change to the new file.

  • When I save the image file locally, it does load image quicker than image link. However, the table still takes seconds to load. I think in the long run if my list ever getting increased, would saving image locally or embedding image link make any big difference in term of loading speed ?

@blacksmithgu
Copy link
Owner

Embedding local images will definitely be faster - as it is, it is requesting them from the web every time you load the page/table, which may take a few seconds especially as you add more images.

Can you take a performance profile? You can make one by pressing Ctrl+Shift+I to open the developer tools, then go to "Performance", and then press the "Record". Then just click onto the slow page, wait for it to load, and stop the recording and upload the resulting file here.

@Missionary-OSBS
Copy link
Author

Missionary-OSBS commented Jul 1, 2022

Profile-20220630T171615.json.zip

You could have a quick look. The page was loaded very slowly, especially in the future when the list is getting more content.
Just let me know if you could open the file. Thank you.

@blacksmithgu
Copy link
Owner

blacksmithgu commented Jul 3, 2022

Thanks for providing a performance profile - I took a look. It looks like there are a fair number of fast Dataview calls, along with a single very slow 2 second call which spends 99% of it's time trying to render markdown.

If you remove the images, does loading time improve? I suspect the issue here is Obsidian's renderMarkdown renders images synchronously, which would be very slow.

@Missionary-OSBS
Copy link
Author

Thanks for taking a look.

I bet removing images would definitely boost up the loading speed. I just came up with other solution: using callout to hide dataview table in default → reduce amount of time to load. It works fine with my workflow.

@ItsFullOfCode
Copy link

I realize this thread is old but maybe the following observation will be useful to somebody. Rendering any dataview table with dv.view() had recently become quite slow on my Obsidian Windows installation. A couple of tables with 70 results took over 30 seconds to load.

The Performance profile indicated that the recent dataview performance hit might be related to the installation of the Markdown Attributes plugin. Once I disabled this plugin dataview rendering became again near instantenous. I'll attach a screenshot of the performance profile.

gnAU6Hktlk

Many thanks for the outstanding dataview plugin! Together with other fantastic plugins it makes Obsidian the marvelous and flexible tool it is!

@AB1908
Copy link
Collaborator

AB1908 commented Sep 15, 2023

@ItsFullOfCode if it happens only on enabling that plugin, it's probably something related to that plugin itself. Can you try asking the author of that plugin? I believe it was javalent.

@blacksmithgu
Copy link
Owner

To follow up on this, slow tables are essentially caused entirely by markdown rendering time. Dataview renders every column as markdown using MarkdownRenderer#renderMarkdown, a utility function provided by Obsidian. This implicitly then may result in a bunch of plugins also changing how markdown is rendered and results in very slow renders.

I don't have any amazing fixes for this right now outside of providing a way to opt-out of rendering specific columns as markdown.

@AB1908
Copy link
Collaborator

AB1908 commented Sep 15, 2023

Ez just monkey patch the renderer /s

@ItsFullOfCode
Copy link

@AB1908 Thanks for the suggestion. Done.

@ItsFullOfCode
Copy link

@blacksmithgu Thanks for the explanation. It seems to me that dataview is doing nothing wrong here, so no fix required imho. :-)

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

No branches or pull requests

4 participants