Gaining Speed: Empty Prefetch on your XP System

by [Published on 28 April 2005 / Last Updated on 28 April 2005]

A little known tweak that can help you gain some performance on your XP Professional (and Windows Server 2003) related systems is to periodically empty the prefetch folder. The prefetch folder is used to help speed up the loading of programs; XP will load programs it thinks you need before you ask for them yourself.


 For a complete guide to security, check out 'Security+ Study Guide and DVD Training System' from Amazon.com

Since applications are nothing other than data (files, folders which make up the programs), they are susceptible to the same form of punishment all other data on your system is open to… defragmentation, as well as just residing on your hard disk, if needed, the program must be called from the disk and loaded into memory. If XP (or 2003) tries to prefetch applications you don’t regularly use, then you may be wasting memory. In this article, we look at how to speed up performance by emptying the little known prefetch folder and allowing XP to start the prefetch determination and archiving process over again.

Prefetch Basics

The prefetch folder resides on your local hard disk, under the Windows folder.

%systemroot%\prefetch

-or-

X:\windows\prefetch    

Where ‘X’ is the drive letter where you have Windows installed. Either path will get you to your local system. The second path is for those who have the default installation on the most commonly used drive letter, C:\

The prefetch folder is used for speeding up your system. The way it does this is by doing the following:

  • Windows XP is configured to prefetch application and program components so that when you load them to memory; it appears to be very quick.
  • When XP does this the first time, it winds up copying portions of the program to the prefetch area of your local disk.
  • When XP boots up, XP will prefetch portions of the files you use the most.
  • XP loads all associated files, libraries, and pointers necessary to run the program in advance, the preloaded subset makes your system appear quicker.

Prefetch when unattended can also slow down your system. This is because over time

  • XP will retain a copy of a portion of a program in the prefetch folder even if you only use it one time, which is not good. Since you may not use the program again, you may impact the performance of your system by having portions of a program you do not use loaded in your system's memory.
  • XP systems with very low hardware resources (such as memory and hard disk space) will definitely be affected by an over-bloated prefetch folder.

Open and Empty the Prefetch Folder

To view the contents of your prefetch folder, you only need to open to it. You can follow the path outlined earlier to view the prefetch folder. You can use Date Created or Modified fields to attempt to figure out how old each prefetch file is, this may help you determine what can be deleted and what you may want to keep. The easiest way to do this however is to just delete the contents and then start to open and use your common programs again – XP will go back through the same process and prefetch what you need.

You'll then see the contents of a very full prefetch file as seen on this XP client:

Note:
The layout.ini file can also be deleted without a problem. *.ini files are ‘information files’ that are used by Windows to make configurations. Layout.ini contains prefetch information for XP's disk defragmentation system (defrag). Information in this file is used by the defragmenter to move programs and files on your workstation's hard drive to a more favorable location, speeding up direct read times.

Cleaning out the folder

As you can see, just like the TEMP directory on your system, the Prefetch folder can fill up with lots of unused entries and take up needed space. The folder space isn't really what you are solely worried about, it’s all this 'preloaded in memory' stuff that you are trying to avoid. Memory is priceless… it's what makes your system 'seem' fast. In reality, you load everything from your hard disk… the more memory your system has, the more the operating system will attempt to load and keep loaded in memory. You always… always want to keep this area as free and clear as possible because when it fills up – it immediately impacts the system. Paging from disk to memory and back again taxes system resources and slows down your system. As well, running out of hard disk space simultaneously puts a strain on your system's page file, which needs all available free hard disk space to accommodate 'virtual memory'. In sum, you can improve system performance by deleting files from this folder not only to keep it out of memory but to also keep it off your hard disk. This is not space that will be gained back unless you are using fewer programs now then you were at another time. An example may be if you previously used many Graphic Art tools and now you aren’t. Since these tools and their environments are so large, removing the prefetch files for these tools may claim a lot in system resources back for you.

When cleaning out your folder, you have two choices: Selective or All

You can be selective or you can mass delete everything. Ctrl + A and then Del. Gone. No problems doing it that way, again – you can regenerate what you need upon reboot and reload. You can also be very selective, although the first method is the easiest, quickest and most effective way of doing it. Remember - to delete all the files, simply select them all in Explorer and select the delete key on your keyboard. Reboot, re-launch your programs and you are back in business. Programs no longer used often will remain dormant until used again.

You shouldn't delete these files often because then your system is constantly taxed in creating file and then you deleting them. This of course will put a strain on your hard disk and leave you needing another defrag. Use this tweak sparingly, remembering it when you do spring cleaning. You can tie this into a routine when you 'delete' unused programs, go and clear out the prefetch folder… cleaning out any other temp related folders and then a scandisk and defrag. If you spend a few bucks and get a memory upgrade, your system will 'appear' much quicker. As well, you will reclaim some serious hard disk space – and clear out memory as well. Heck, you may not even need that new stick of memory after you clean out your system. So, is there anyway to modify prefetch? Yes there is.

Changing Prefetch settings

To change settings for your Prefetch folder, you may need to take a trip into the system's Registry. You can do this with Regedit.

Start => Run => type Regedit => Enter

Now that you are in the Registry, you can change the way that Prefetch behaves by making a change in the registry. This is helpful when you want to alter Prefetch or disable Prefetch completely. Low resource (memory, hard disk space, etc) systems may need this functionality disabled to get the system to run more efficiently.

When the Registry Editor Dialog box opens, navigate to this value:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\PrefetchParameters

In the right side pane, look for the key named EnablePrefetcher. The value of this key represents how Prefetch will operate.

Values you can choose from include:

0: Disable

1: Application Launch Prefetch

2: Boot Prefetch

3: Prefetch everything

Simply type the number in that you want (keep all other settings the same) and click OK. Rebooting the system will give you the new Prefetch setting.

Summary

In this article we covered the basics of cleaning out the Prefetch folder and gaining more speed on your XP (or 2003) system. Stay tuned for more tweaks!

Links and Reference Material

Backup your system Registry
http://www.windowsnetworking.com/articles_tutorials/Windows-XP-Registry-Backup.html

Featured Links