Please note these steps require a Displayr license.
R-based items are processed differently than Displayr's built-in features. If the R code is simple and straightforward enough, Displayr is able to process the code using Displayr's Native R Interpreter. More typically, R-based items (you will see an R CODE box on the Properties tab) are processed on a remote R server, and both the data and R code need to be sent to the R server for processing, see how our R servers work here.
For R Calculations on the page, you can review the timings of the different parts of processing (if using an R variable or R data set, you can copy R variable and R data set code into a Calculation for review). These timings can help you identify bottlenecks in the processing where you may be able to make the processing more efficient. For instance, is your item spending more processing time sending over the data or processing the code.
To see the timings for a Calculation:
- Select it
- Check Data > OUTPUT > Show raw R output.
The calculation below takes a total of 0.7 seconds, but only 0.23 of the seconds were spent performing the actual calculations, with the rest of the time spent transferring data and setting up things (overhead) on the R server. We can also see that 10.4KB of data was sent to the R server.
Technical details
Keep in mind, there will always be an overhead cost to processing via an R server. Overhead includes getting things loaded into the R session, connecting with the server, and other server-side things that need to be setup to run the code.
This is why using Displayr's Native R Interpreter can speed up performance. If Displayr's Native Interpreter is used to process the R code, the R item will not show timings and instead will say "This R code has been optimized for fast execution.", see the Use Displayr's Native R Interpreter for more detail about this.
Next
Minimize the Size and Distance of Data Being Moved