Forum Discussion
R visualization runs slow
- 6 years ago
Hi Anonymous,
Page changes within a report are treated as a 'data update' event within a visual container and they're all refreshed. This is a bit of a downside of the R and Python visuals.
Each visual is treated as a sandbox and essentially its own runtime environment. As Power BI visual containers are web-based, the data frame + script is sent to the "server" on each visual update for processing - either the specified R instance on your local machine, or the version hosted by the Power BI service if your're hosting up there - and returned back to the client (your visual container).
There is certainly the apperance of a "cold start" while this is going on and can be quite frustrating if you have a lot of visuals on a page or frequently change slicers or cross-filter. It's one of the reasons I moved to custom visuals in TypeScript, as you can structure your code to do most of the processing be done client-side (unless you're specifically sending data over HTTP for processing).
David Eldersveld has a really good post on optimising R and Python scripts within Power BI, or at least as much as can be given the architecture in-place, and explains a lot more about what happens under the hood (much better than I can).
This may not give you exactly what you need but might help you with planning out an alternative approach if you want to stick with R inside Power BI.
Daniel
If my post solves your challenge, then please consider accepting as a solution to help other forum members find the answer more quickly 🙂
Hi Anonymous,
Page changes within a report are treated as a 'data update' event within a visual container and they're all refreshed. This is a bit of a downside of the R and Python visuals.
Each visual is treated as a sandbox and essentially its own runtime environment. As Power BI visual containers are web-based, the data frame + script is sent to the "server" on each visual update for processing - either the specified R instance on your local machine, or the version hosted by the Power BI service if your're hosting up there - and returned back to the client (your visual container).
There is certainly the apperance of a "cold start" while this is going on and can be quite frustrating if you have a lot of visuals on a page or frequently change slicers or cross-filter. It's one of the reasons I moved to custom visuals in TypeScript, as you can structure your code to do most of the processing be done client-side (unless you're specifically sending data over HTTP for processing).
David Eldersveld has a really good post on optimising R and Python scripts within Power BI, or at least as much as can be given the architecture in-place, and explains a lot more about what happens under the hood (much better than I can).
This may not give you exactly what you need but might help you with planning out an alternative approach if you want to stick with R inside Power BI.
Daniel
If my post solves your challenge, then please consider accepting as a solution to help other forum members find the answer more quickly 🙂