Pagefile ... SSD, HDD, RAM

The page file (aka. swap file or swap partition) is present in most operating systems today, including Windows, Linux, Android, MAC ...etc. It is used automatically by the OS to write out "unnecessary data" from the memory to the hard disk or SSD, thus freeing up some RAM.

In the early days, when you probably didn't do much multi-tasking, you could only notice this procedure in application loading - and unloading times, BUT on a modern multi-tasking system it can play with your nerves, as it may add significant loading time to each ALT+TAB you press.


In this picture you can see the average speed of the three hardware components. Without a doubt the RAM is the best place for currently used data, as it can be read and written at above 20GB/s, while the SSD is about 40 times slower at sequential read/write and 700 times slower at random (4KB block) read/write. The classic hard drive is even slower, as it can read/write at around 200MB/s sequential and around 2MB/s random (4K blocks).

So let's you have a Windows 10 PC with 4GB RAM and a 500GB hard drive, on which you have a 3GB Page File. When enough RAM is free, starting an application means loading app files and some windows files from the hard drive to RAM at the hard drive's maximum speed (usually close to its maximum sequential read speed).


When there's not enough free RAM, Windows will move some of its resident files and parts of the loaded app(s) to the page file, while at the same time loads the new app you clicked into RAM. In this case, the loading speed will be closer to the hard drive's random read/write speed, as Windows is doing more things at once.

When you switch between apps, the procedure is almost the same, it may take the same time as loading the second app. 

If you have an SSD instead of the hard drive, load times will be about 5-10 times faster, BUT still far from the full potential of the PC.

The real speed increase happens when you disable the page file, assuming you have enough RAM (otherwise you'll be unable to load the app). 

With the page file disabled, switching between apps is instantaneous, as both apps are in the RAM, so nothing needs to be loaded/unloaded.

CONCLUSIONS:

  • RAM is the first component you upgrade if you're dissatisfied with loading and multi tasking speeds
  • even if you have enough RAM, Windows will still use the page file (though not as much as when you don't have enough RAM), until you disable it.
  • some apps don't run without the page file. In such cases, if you know you have enough RAM, try to reduce the page file size as much as you can.
  • the page file adds a significant amount of wear to you SSD or HDD (at least 30GB writes per day in my experience)
The page file can be set/disabled in Control Panel - System - Advanced System Settings - Performance Settings - Advanced - Change


NOTE: I have over simplified things. Operating systems have much more complicated virtual memory (page file, swap file, swap partition ...etc.) management, but the basic concepts I described are valid in most situations.