Profiling R code

In the big data era, where we might have petabytes of data, maintaining the performance of applications is crucial. The application performance might go down because of data-loading operations or calculations. To detect such operations, we have a package called profvis. This tells us how much time a line of code takes to execute. Install the package as follows:

install.packages("profvis") 

RStudio has provided support for the profvis package. Let's take a look at how to use it:

library(profvis) 
profvis({ 
plot(iris$Sepal.Length,iris$Sepal.Width) 
 
plot(cars$speed,cars$dist) 
}) 

profvis encloses the code to be analyzed. In the following screenshot, we can see the output. For each line of code, we can see the memory usage with the time taken:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.129.39.252