Compilation speed and internet connection (cmdstanr)


I have noticed that model compilation in cmdstan takes ~10 times longer when I am connected to my work wifi network. I am a bit confused, because I assumed there should be no link between being connected to the internet and model compilation process. However, the empirical difference is ridiculous. Does anyone know why this might be happening?

After cmdstan is installed and built for the first time there should be no internet access required, so this is certainly odd!

Are you comparing to some other wifi network? If so, have you measured when not connected to the internet at all?

Yes, I am currently simply disconnecting from the internet whenever I need to compile a model.

To answer your question, I just tested it by connecting to my mobile data, and it’s as fast as offline, so it seems only my work wifi slows it down considerably… I imagine it has something to do with security, but I am very puzzled how is it possible and whether there is any way around it, apart from disconnecting each time I compile.

This is puzzling. The only thing the cmdstan build process shells out to the internet for is to download the stanc3 compiler in development builds. In a released CmdStan, it shouldn’t connect at all.

You can try disabling this ability entirely by passing STANC3=some/path/that/exists/ to make. This will tell it to try to build stanc from sources found in that folder – which you don’t have or need, but it completely disables the download ability, so it should give us good information either way.

The other thing I’ve thought about is certain antivirus software is very suspicious of compilations. Touching a lot of files and writing out new ones looks a lot like some kinds of ransomware. Is it possible that connecting to your work wifi is enabling some extra protections?

Yes, this seems very likely. Since it’s a governmental institution, the security is pretty ridiculous. I’ll drop a query to the IT team about this, cause I assume I can’t really do much about this on my own. Thanks!