28

From my personal experience I've noticed that disabling the page file in Windows XP has given me, in general, the most speed gain out of any other software change I can make. Obviously this has to be done when a significant amount of RAM is available. Typically I find that it works nicely with +2GB of RAM. The only issues I've ever really had were loading up Adobe Photoshop.

Is this really a speed improvement or am I imagining it?

Note: In order to actually turn it off, you must not just set it to 0MB, but disable it. Otherwise Windows will just expand it when it needs to in order to meet its needs.

Jonik
  • 5,940
Joe Phillips
  • 1,430

9 Answers9

25

Don't mess with it, let Windows figure itself out.

This ServerFault answer is the most excellent explanation of why:

Many people seem to assume that Windows pushes data into the pagefile on demand. EG: something wants a lot of memory, and there is not enough RAM to fill the need, so Windows begins madly writing data from RAM to disk at this last minute, so that it can free up RAM for the new demands.

This is incorrect.

The punchline:

Removing pagefile entirely can cause more disk thrashing.

Factor Mystic
  • 13,015
19

Windows XP flushes minimized applications to disk like crazy.. try it yourself, start downloading a large torrent and minimize everything. Pretty soon almost all of your RAM is used as file cache for the torrent instead of your other applications. Disabling the page file will prevent this behavior.

In Windows Vista and Windows 7 though, the system handles this scenario much, much better.. so I'm not sure disabling the page file in these versions will do much of a difference.

Some games require you to have a page file even when it's not really needed, I noticed this recently when trying to play a game demo I downloaded from Steam. Even though I had 6 gigs of RAM available the game refused to start until I created a tiny, tiny page file.. sigh

Personally, when I have plenty of RAM, I prefer to go without a paging file.

zidar
  • 548
7

from microsoft answer "disable swap file"

http://social.answers.microsoft.com/Forums/en-US/w7performance/thread/0bd8a75c-2607-4468-8342-c35ea82ea670

Ken Blake, Microsoft MVP

is there any performance gain from that ?Thank you.

Can you? Yes. Should you? No, definitely not.

Is there any performance gain from doing that? No, and there's a possible performance loss.

First of all, 2GB is not a lot of RAM, it's the minimum amount that most people should have.

Second, if you don't have a page file, you can't use all the RAM you have. That's because Windows preallocates virtual memory in anticipation of a possible need for it, even though that allocated ay never be used. Without a page file, that allocation has to be made in real memory, thus tying up that memory and preventing it from being used for any purpose.

Third, there is never a benefit in not having a page file. If it isn't needed, it won't be used. Don't confuse allocated memory with used memory.

Ken Blake, Microsoft MVP (Windows Desktop Experience) since 2003 Ken Blake

miki
  • 71
  • 1
  • 1
6

I would say enable.

No matter how much RAM you have, there will be scenarios when a page file is, at the very least, useful. Also, it should be noted that when there is a page file, much of the Windows runtime is offloaded there for most of the time. The reason? While it's needed in memory, it isn't needed at the moment. Putting it in the swap file may means it takes longer to access, but it leaves more RAM free for the programs you are actually using.

The reason your performance increased is because you were forcing the whole system to be loaded into RAM, which is admittedly much faster. However, my guess is that when you start using a bunch of programs at once, especially memory-heavy ones like Firefox and your Photoshop, that improvement will go right out the door.*

However, it is possible that you will never encounter that problem simply due to your computing habits. I know that if I tried to turn off the page file, I would not enjoy it one bit. So if you really want to, try leaving it off for a while and see what happens, you can always turn it back on again later.

*"That paragraph was a fair amount of speculation" /disclaimer ;)

Sean
  • 309
5

I would say enable but move it to a second drive, preferably one not in use by some other I/O hog. That has often given me better speed than disabling the pagefile entirely. Of course, maxing RAM is a good parallel optimization.

romandas
  • 262
3

I disable the swap file on 32-bit Windows systems with 4GB of physical memory. Having virtual memory on isn't going to add any more addresses to the system, and having it off means I never have to wait for Windows to swap in or out.

kquinn
  • 780
3

I disable the swap file on 32-bit Windows systems with 4GB of physical memory. Having virtual memory on isn't going to add any more addresses to the system, and having it off means I never have to wait for Windows to swap in or out.

No. Address space is as follows: every PROCESS has its own 31-bit address space (lower 2GB) and kernel has its own 31-bit address space (always same, regardless of which process owns current thread). This gives you 2GB * number of processes of available user-mode address space. Without a swap user-mode space is limited to physical memory size minus kernel memory size (usually around 200 MB). Of course, there may be some artificial limit on how much virtual memory your system can allocate, but I'm not an expert in Microsoft's licensing policies.

Also, note that disabling swap does not necessarily mean that there will be no page-faults resulting in disk access. The swap file is not the only file that memory is mapped to. Every executable file (that is, .exe or .dll, except kernel mode drivers) has its own disk backup - namely, the exe file. Of course, pages that have been modified in-memory, such as writable data segments, IAT, or even code segments (in case of packed executables, for example) need separate swap-backing, but vast majority of code/static data/resources do not need swap and... can be removed from memory when system is low on resources. When the process needs an access to such data, page fault and disk access will occur, whether swap is enabled or not.

kmode MZ
  • 31
  • 1
2

Sean Nyman previously said "especially memory-heavy ones like Firefox and your Photoshop, that improvement will go right out the door."

I just wanted to add that in Firefox, if you type about:config into the address bar to go to the advanced settings in Firefox, you can add a new string for browser.cache.disk.enable and set the boolean value to false and this will force Firefox to cache only to RAM. You can also add the string browser.cache.disk.capacity and specify a value to control how much space in RAM Firefox will use for the browser cache. I hope this helps. I have mine set to cache in RAM and Firefox is always super fast.

I also have an SSD drive for the system drive in this laptop, with a 500GB rotary drive in the secondary bay for storage, and I set the TMP, TEMP, and Temporary Internet Files folders to point to the rotary drive in Windows 7 Pro, along with moving my pagefile.sys over to my rotary drive on D: and my system works very fast like lightning. I have 4GB RAM anyway, so I don't think Windows 7 even uses the pagefile much, but what is the harm in leaving it turned on?

karel
  • 13,706
ojosch
  • 21
0

Disabling the swap file is perhaps the single most dramatic improvement you can use to increase the performance of your computer. In the typical scenario, most laptops use physical magnetic hard disks which have moving parts. These drives are very slow when compared to the speed of the memory in your computer. So if you have the ram to force windows to stay "within it's means" and never write out to the disk, it will only slow down when it has to hit the disk for a file not already in memory. Everything in memory will run significantly faster. The idea is to cache the entire operating system so it only reads or writes to a physical disk when it needs something not already in memory.

RAM read/writes happen in nanoseconds versus milliseconds on physical magnetic disks.

Now something to consider is that there are now new swap file options becoming practical. If you use a solid state disk or you get windows to put the swap file on a SD card, you will also experience significant performance increases.

Just my $0.02

Axxmasterr
  • 7,966