Rstudio slow to respond when in a project on H drive on windows

When i use Rstudio projects on my H drive I have a very slow response time (Rstudio is slow to register some commands e.g. running a code chunk or simply saving. I have spend hours googling. If I use my C drive the problem disappears. My Rstudio version is 1.1.463 and I cannot update...
I am quite sure that the problem has nothing to do with Git being enabled with projects and also the problem is not there when I don't use Rstudio projects.
This post is related to my problem but it does not solve my problem:
RStudio Desktop slow and laggy when project is on a network drive

Where do you keep your R-packages?

You can use .libPaths() to find out.

For me it's:

[1] "/Library/Frameworks/R.framework/Versions/3.6/Resources/library"

@filipwastberg: They are in my C-drive,

"C:/Program Files/R/R-3.5.2/library"

Is that all you get from .libPaths()? One folder?

@filipwastberg: yes. Also when I am in a project on the H drive.
The problem is only when I use Rstudio projects.

Alright. I have had this problem when my packages where in the H:/-drive. When I first installed R it saved the base-packages in "C:/Program Files/R/R-version/library" and then created a separate folder under the H:/-drive where it kept the packages that I downloaded. So I had two .libPaths(), one under C and one under H. This caused R-studio to be slow at times. The solution was to create a separate folder on my C-drive and then create an environment variable called R_LIBS_USER where the value was my new folder on the C-drive. But I guess that is not the case here.

@filipwastberg: No I don't think that is the problem because everything is fine when I don't use projects.

But it works when you open the project from your C-drive rather than the H-drive?

@filipwastberg: I have not tried to move a project to the C drive to see if the problem disappears. But when I have created a test project on C drive the problem was not there.

@filipwastberg: Yes no problem when I move a project to the C drive.

Hm, well, I'm no expert but from my understanding the H-drive usually is a cached version of the C:/Users/user. So when you create something in C:/Users/user it should be on the H-drive aswell. So I guess a workaround for you would be to always start projects on the C-drive.

@filipwastberg: So why do I not have a problem with a regular script without a project?

I'm afraid I don't know. But if possible you should ask your IT for permission to update Rstudio and see if that fixes anything.

I don't have a solution, just an explanation...

Some background information first. RStudio causes tons of disk IO (especially if your use git for version control, see the question you metioned) so any hiccoughs with disk access will result in noticeable lags in RStudio session.

H: is usually a network drive so it will be much slower than a local disk (C: is usually local) by its very nature and there is nothing we can do about it. Even the fastest HPC-grade fiber optic data center networks are slower than local disks. So whenever your RStudio project is on the H: drive you will see the lagging.

Now to your question:

I think the reason is that the regular scripts use the default RStudio working directory (where it stores active session data, environments for the suspended/persistent sessions, configuration settings, etc.) which i likely to be on C: under your user's home directory but projects actually create per-project working subdirectories. So all those working and temporary files will go to the network drive and any time RStudio reads/writes those files (which is very, very often) you would see the lags.

The solution is to never put your projects on the H: drive and use it for backups only...

@alexv: Okay, thanks, I will stop looking for a solution.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.