obsidian-dataview icon indicating copy to clipboard operation
obsidian-dataview copied to clipboard

Dataview table loading speed is getting slow

Open Missionary-OSBS opened this issue 3 years ago • 6 comments
trafficstars

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 avatar Jun 30 '22 00:06 Missionary-OSBS

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?

blacksmithgu avatar Jun 30 '22 01:06 blacksmithgu

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 ?

Missionary-OSBS avatar Jun 30 '22 04:06 Missionary-OSBS

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.

blacksmithgu avatar Jun 30 '22 21:06 blacksmithgu

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.

Missionary-OSBS avatar Jul 01 '22 00:07 Missionary-OSBS

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.

blacksmithgu avatar Jul 03 '22 23:07 blacksmithgu

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.

Missionary-OSBS avatar Jul 03 '22 23:07 Missionary-OSBS

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!

ItsFullOfCode avatar Sep 15 '23 13:09 ItsFullOfCode

@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.

AB1908 avatar Sep 15 '23 15:09 AB1908

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.

blacksmithgu avatar Sep 15 '23 21:09 blacksmithgu

Ez just monkey patch the renderer /s

AB1908 avatar Sep 15 '23 21:09 AB1908

@AB1908 Thanks for the suggestion. Done.

ItsFullOfCode avatar Sep 16 '23 17:09 ItsFullOfCode

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

ItsFullOfCode avatar Sep 16 '23 17:09 ItsFullOfCode