Package load speed: Windows vs Linux

My general sense is that Windows performance may get less attention than Linux performance. It seems much more likely that I’m the first one to recognize an issue on Windows. This could be merely because many of the developers and users of Julia tend to primarily work on Linux.

The exchange that Kristoffer linked above revealed an issue that was affecting Windows users more than Linux users. stat is regularly used when accessing a file since it determines basic information such as does the file exist and if you have permission to access it. In particular, a basic stat operation on Linux is about 100x faster than its Windows analog (~100 nanoseconds versus ~10 microseconds). At a small scale a few microseconds is not noticeable, but over many file accesses this becomes noticeable on Windows before Linux. In that case, Julia was accessing the same file repeatedly. On Linux the cost for doing so is negligible but the cost is noticeable on Windows.

Fortunately due to Windows Subsystem for Linux 2, this is quite easy to evaluate now. Simply profile the operations in Windows and WSL2 and report the output of the following.

using Profile
Profile.clear()
@profile begin
   <task that is slower on Windows than WSL2>
end
Profile.print(; C = true, format = :flat, sortedby = :count, mincount = 4)

The difference between Windows and WSL2 does point to something having gone awry in the Win32 API or NTFS file system rather than a fundamental issue in the Windows NT microkernel.

3 Likes