There are several essential system files in Windows that are read from and written to very often - system paging file, different Event logs and Security Accounts Manager (SAM) database. By far the most used file of them is system paging file that extends computer's Random Access Memory (RAM). If these files are badly fragmented, the overall performance of Windows gets a big bad hit.
Windows tries to grow paging file dynamically - if computer's RAM is full and running programs still require more memory space, this information gets written to the paging file (aka Pagefile or Virtual Memory) on hard disk. It might seem a very good idea to keep the paging file size at its optimum (or just as much as needed), but in real life the growing and shrinking paging file gets fragmented quickly and starts decreasing overall performance.
To prevent that from happening, set paging file to a fixed size. But please remember, if you upgrade memory (add more) later, you must also reconfigure paging file size accordingly - otherwise you'll get random "your computer is low on memory" errors while running multiple programs at once.
File fragmentation is a big issue on traditional hard drives (SSD-s do not count) that usually does not get much attention. File fragmentation occurs when a hard disk partition contains tens of thousands of files (like it always does) and a file gets updated but there is no room right after it to keep the file written sequentially. So the updated part gets written elsewhere on the hard disk, sometimes in one part, sometimes to several different places on the hard disk. This means that the next time Windows wants to read from or write to the file, the hard disk controller must access several places all over the disk to read or write information - meaning that the file's access time gets higher and you must wait longer for an operation to complete. For one file this might mean only a few milliseconds, but if your hard drive is nearly full and fragmentation level is high, this turns easily into tens and tens of seconds of waiting.
How to configure paging file in Windows
Open System Properties or System Information using keyboard shortcut Windows Key+Pause/Break. Alternatively, right-click Computer icon on Desktop or Start menu and click Properties.
In Windows XP, System Properties window opens right away. In Windows Vista, 7 and 8, click Advanced system settings on the left.
Open Advanced tab in System Properties window. Click Settings in the Performance section.
Performace Options window opens. Open Advanced tab and click Change in Virtual memory section.
In Virtual Memory window, find the last section, Total paging file size for all drives, and see what's written in the Recommended row. Add about 200 megabytes to this value to get a good paging file size.
In Windows Vista, 7 and 8, clear the Automatically manage paging file size for all drives check box. Windows XP does not have this option.
Next, click to select your system drive (the drive where Windows is installed, most probably C:) in the list of available hard drives. Click Custom size and type the calculated value (Recommended + 200 MB) into Initial size (MB) and Maximum size (MB) fields. Verify you have sufficient amount of free space on the selected drive by looking up the value in Space available row.
In case you have multiple physical hard drives (not partitions or volumes!) in your PC, you can enhance performance even more by putting a larger part of paging file to the secondary drive. Leave about 100-300 megabytes of paging file on system drive and put the rest on the other drive (select the secondary drive in the list, click Custom size, specify values and click Set).
Click OK in the Virtual Memory window to accept changes.
In most cases, a notification stating "The changes you have made require you to restart your computer before they can take effect" appears. Click OK - your PC will not restart yet!
Close Performance Options and System Properties windows and restart your computer.
Let me remind you again - please resize paging file if you add more RAM to your computer later. You can verify that virtual memory size is sufficient by looking for Event ID 49 ("Configuring the Page file for crash dump failed. Make sure there is a page file on the boot partition and that is large enough to contain all physical memory") in System Log of Event Viewer.
To defragment Windows paging file, install Defraggler and use boot time defrag.