Bergam0t / nhs_ptd_power_bi

PowerBI/Plotly implementation of the NHS-R Making Data Count package
MIT License
6 stars 1 forks source link

Investigate bundle size reduction #28

Closed Bergam0t closed 1 year ago

Bergam0t commented 1 year ago

Performance of this visual isn't the greatest - but I don't know how much of that is just a limitation of R html visuals.

I wonder whether experimenting with the partial_bundle feature may lead to a reduction of the output html, which could lead to faster loading.

https://rdrr.io/cran/plotly/man/partial_bundle.html

Bergam0t commented 1 year ago

partial_bundle was released in 4.8.0 and the service uses 4.9.2.2 so theoretically it should work

Works on desktop though can't really say either way whether it helps (as load times already inconsistent)

However, fails on PBI service with error message

"Error in curl::curl_download(paste0("https://cdn.plot.ly/", bundle_script), : Could not resolve host: cdn.plot.ly"

I wonder if it may be possible to use a completely offline version of plotly that is bundled with the visual. This seems to suggest it may be possible in principle for plotly plots: https://stackoverflow.com/questions/73254681/how-to-setup-plotly-script-in-rmarkdown-to-reduce-html-file

This would be beneficial by removing need to contact plotly cdn to download the bundle, which makes the plots robust to the plotly cdn going down.

Bergam0t commented 1 year ago

done in #36