R performance is faster on Posit Desktop than on Posit Workbench

Follow

Problem

You may notice that scripts execute faster on your local computer using Posit Desktop, when compared to using Posit Workbench. 

 

Is there a solution?

Not really, and there's a good reason for this. There is a difference in CPU clock speeds for servers and on laptops, usually in favour of the laptop. Any differences in CPU, especially clock speed, can translate to the differences in performance that you see. This also depends on the type, make, and model of the CPU, as well as how it handles processing between threads. If the CPU on the laptop and on the server are identical, then you should see similar performance. That said, most of the time, the CPU on laptops are substantially different to the CPU provided on servers. Laptops also feature more powerful graphics processing, due to the incorporation of dedicated GPUs. It's worth mentioning that most of the time, a laptop will outperform a server when handling code.

 

Isolation Testing

You can test this between your different environments by running the R code below:

library(tictoc)

tictoc::tic()
for (i in 1:100){
j=i+1
}

tictoc::toc()

The code above simply runs a for loop from zero to one hundred and counts the time it takes to execute this loop. This is helpful because it is a very minimal code block to run, which isolates the potential for libraries and subroutines slowing down other core components of your computer or server, and focuses on minimal code execution. Ideally, you will run this:

  • Workbench IDE on the server
  • R command line on the server
  • RStudio IDE on the laptop
  • R command line on the laptop

This will allow you to see the parity between your environments.

 

Support Ticket

If you still have issues after completing the above, you can always lodge a support ticket, where our group of friendly, and incredibly knowledgeable staff can assist with any issues that you may be having. You can submit a ticket here:

https://support.posit.co/hc/en-us/requests/new

Comments