How to Keep Your Paging File Defragmented
We recently discussed defragging the MFT, or Master File Table ( http://langa.com/newsletters/2006/2006-10-09.htm#4) . Here's a question in a similar vein:
Hi Fred, Just a quick question about the Windows XP paging file which you wrote about recently. In Windows 9X a useful trick with swap file was to make the minimum and maximum equal so that Windows did not waste time enlarging and shrinking it. This was said to give a small improvement in efficiency. Is there any merit in doing the same thing with the XP paging file? Regards, Peter
In a word, yes. The reason is that the "Initial size"
of your paging file (formerly known as the "swap file") is really the
"permanent" part of your paging file. The difference between the "Initial size"
and "Maximum size" is really the potential size of a temporary paging file added
to the permanent one. That temporary file will be sized and created as needed
and on the fly, potentially grabbing chunks of far-flung disk space wherever it
can. In other words, it may be defragmented and thus degrade the performance of
virtual memory.
By making "Initial size" and "Maximum size" equal to each other, you're really
just telling Windows that you want nothing to do with temporary paging files,
and that you want only one sufficiently-large permanent one. By defragmenting your disk before
creating this permanent paging file, you'll make sure that the permanent file
isn't fragmented, either.
Here's how to get to the Virtual Memory dialog box, which governs your paging
file: Right click on My Computer, choose Properties, then the Advanced tab.
Click on the Settings button in the Performance box. Click on the Advanced tab,
then the Change button.
The first step is to get rid of your paging file by clicking on the "No paging
file" radio button. Click on the three OK buttons, defragment your disk, then
reboot.
Defrag to open up contiguous hard disk space, and then go back to the Virtual
Memory dialog box and set the "Initial size" and "Maximum size" to the same
number. You can use the "recommended" size shown in the dialog; in XP, the
recommended size is usually fine. But if you prefer to pick a different size, a
good rule of thumb for most users is to create a paging file that's 1.5-2 times the
size of your physical RAM. Then, click OK three times and you're done!
