Usually I don't notice a difference between the time of execution of a rnotebook chunk vs. console execution. But with my new company laptop, I'm noticing a difference within Rstudio but not vscode (using a .rmd file).
What could be causing the slower chunk execution in rnotebooks? I've noticed this delay across many experiments. It's very noticeable, whereas code is almost instant in vscode .rmd files
timein <- proc.time()
tibble(
x = 1:5000000,
y = 1,
z = x*0.5
)
timeout <- proc.time() - timein
print(timeout)
Rstudio rnotebook timing:
user system elapsed
0.16 0.05 2.81 Rstudio Console timing:
user system elapsed
0.13 0.02 0.16 Vscode rmd chunk timing:
user system elapsed
0.16 0.01 0.22
Thanks for the reply. I understand the function is vectorised, I was just using the for loop to demonstrate the inconsistencies between the platforms. I'm trying to understand why my Rnotebook is so much slower than Rmarkdown on other applications. This isn't an issue on my other computers, just this one. To further demonstrate, using your function below are the computation times between Rstudio Rnotebooks and VScode rmarkdown on my machine. Could the problem be my corporate network? :