One more time: do not clean out your Prefetch folder!

Yet another Web site posted yet another “tip” today recommending that you clean out your Prefetch folder to improve performance of Windows. Arrrggghhh! I’ve written about this repeatedly (here and here and here, for instance), but the message doesn’t seem to be spreading very fast. Maybe this quote from “Misinformation and the Prefetch Flag” by Ryan Myers, a developer on Microsoft’s Windows Client Performance Team, will help:

XP systems have a Prefetch directory underneath the windows root directory, full of .pf files — these are lists of pages to load. The file names are generated from hashing the EXE to load — whenever you load the EXE, we hash, see if there’s a matching (exename)-(hash).pf file in the prefetch directory, and if so we load those pages. (If it doesn’t exist, we track what pages it loads, create that file, and pick a handful of them to save to it.) So, first off, it is a bad idea to periodically clean out that folder as some tech sites suggest. For one thing, XP will just re-create that data anyways; secondly, it trims the files anyways if there’s ever more than 128 of them so that it doesn’t needlessly consume space. So not only is deleting the directory totally unnecessary, but you’re also putting a temporary dent in your PC’s performance. [emphasis in original]

Bottom line: You will not improve Windows performance by cleaning out the Prefetch folder. You will, in fact, degrade Windows performance by cleaning out the Prefetch folder. I’ve done performance testing that establishes this definitively. In all the many sites that offer this bogus tip, I have yet to see a single piece of actual performance testing.

Oh, and for anyone who cites this TechRepublic article as a source, let me just say that it contains more serious factual errors than I can count. For instance:

As you boot your workstation or access programs on your workstation, XP’s prefetcher copies portions of those files to the Prefetch area of your hard drive.

That’s completely wrong. The files in the Prefetch folder contain lists of pages that that should be loaded when a program starts. Each file is essentially an index. Windows XP doesn’t copy portions of any files to the Prefetch folder.

When your workstation boots, XP prefetches portions of the files you use most frequently and has any application you’ve recently run waiting and ready to go.

This is equally absurd. If this were true, it would mean that Windows was actually loading into memory every program you’ve ever used, every time you start Windows. That’s not the way it works at all. When your PC starts up, Windows looks in the Prefetch folder to determine how best to load Windows. It doesn’t do a thing with the .pf files for applications (unless, of course, you’ve configured one of those apps to start up with Windows).

If you’re frequently using the same few applications over and over again, prefetching can greatly increase the apparent speed of a system. Rather than waiting for you to click an icon to start a program, and then loading all of the associated files, libraries, and pointers necessary to run the program, XP has all the components of your programs preloaded. When you click an icon to start the program, most of the hard work is already done.

The author just made this up. The .pf files don’t get used at all until you run a program. What actually happens when you click an icon is that Windows uses the information in the Prefetch folder to decide which program segments to load and in what order to load those pages. There’s plenty of documentation for this, including Ryan Myers’ article and this definitive article by Mark Russinovitch and David Solomon, Windows XP Kernel Improvements Create a More Robust, Powerful, and Scalable OS.

The drawback to prefetching is that XP will prefetch a program even if you use it only once or twice. XP will retain a copy of a portion of it in the Prefetch folder. From there, it will prefetch the program, taking resources from your workstation even though you may have no intention of ever using the program again.

Again, the author just pulled this out of who-knows-where. When you run a program, Windows creates a .pf file for it in the Prefetch folder. When you run the program again, Windows looks for this .pf file and uses it to determine how to load the program. The hash doesn’t contain any portion of the original program code. If you never run the program again, that .pf file never gets used, and in fact it gets deleted eventually.

I used to write for TechRepublic. I’ve tried to contact someone there to get them to correct this silly article but have yet to receive a response. It would be really, really great if some of the other sites that have propagated this urban legend would also correct it.

139 Thoughts on “One more time: do not clean out your Prefetch folder!

  1. Yet another great benefit of prefetch is that XP uses .pf files to create and update the layout.ini file. XP’s disk defragmenter then uses layout.ini to optimize the placing of certain boot and application files on the outside of your hard disk. It does this each time you run disk defragmenter manually and also automatically in the background no less often than every third day. This causes your computer to boot up and load applications faster.

  2. The horrid Prefetch meme seems to get tossed out every 12-15 months. Thanks Ed, for continuing to cut this myth down every time it pops up.

  3. Ed Bottegal on June 4, 2005 at 9:21 am said:

    Just curious about “edbott”. As you can see, my address starts with “ebott”, an abreviation of my name.
    What is the story about “edbott”?
    ed

  4. The Point of clearing the predfetch folder is, that if you install new software and afterwards deinstall it, windows will still try to optimize the disk for the non-existing software. Of course, there is no point in flushing this folder daily, but after a month or two it IS quite useful and speeding up the system. On my test-system where I have to install many different software-packages, the boottime decreased from 20secs to only 7!

  5. After a month or two, Windows automatically removes unused entries. So there’s no need to clean this folder.

  6. knightcrawler on July 20, 2005 at 1:35 pm said:

    You can delete it if you made big changes otherwise the layout.ini will have a lot of old data.

    1. Delete all the files in the folder

    2. Turn on the Task Schedule service to automatic and start it if it isn’t already.

    3. Open a cmd window and type or paste this:

    Rundll32.exe advapi32.dll,ProcessIdleTasks

    4. The folder will be rebuilt with the current apps and drivers.

    Also:

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

    dword value = EnablePrefetcher

    0 = Disable,
    1 = App launch prefetch
    2 = Boot Prefetch
    3 = Both (recommended)

    My recommendation for the prefetcher is based on the amount of RAM that you have:

    128MB – Disabled (reg value 0)
    256MB – Boot only (reg value 1)
    512MB or more – Both (reg value 3)

  7. martinelli on August 8, 2005 at 8:34 am said:

    The quality of articles posted on Tech Republic has degraded over the last few years to the point that I only use them as an indicator of possible research I might need to do on subjects. As an original source for operating and networking information, verify anything you see on the site with a known trusted source before even wasting your time.

  8. John Butler on August 15, 2005 at 7:38 am said:

    I liked this comment because there has been a lot of waffle about improving prefetch. Hwoever when I checked the Registry Dword value for my system I found it was set to 5, which is not mentioned, not the recommended 3

    My system has P4 3.4Ghz with x10 large cache SATA disks boots in 1 minute to 1 minute ten seconds so it would seem PF is OK.
    May be the PF value is set by the defragger PerfectDisk?
    John

  9. John, are you sure that you didn’t make this setting yourself at some time in the past, perhaps following advice on some “tweaking” site? I’ve seen this one a lot, but have seen zero credible documentation that it is supported, much less effective.

  10. Pingback: Neil's Smaller World

  11. Pingback: MarteyDodoo.com

  12. Yeah, I too agree about this hoax. The only thing I do regarding the Prefetch folder is that I delete those various “setup.exe-hash.pf” files, i.e. the ones from few of my programs that gets updated frequently and so I use a different executable with the same name each time, i.e. on each installation/updating. Then I also delete .pf files of various temporary processes’ files, although those are rarely created/run on my system. And finally I delete those orphaned .pf files from executables that I moved after the new .pf file was already created (with new file’s location), however, I know that OS would delete them by itself after time. I am just a “maintainance maniac”.

    Then regarding what data that these files contain, I guess it’s quite obvious that they don’t “pre-load” anything (or whatever), they just contain a list of directories, OS-libraries that executable loads/maps/hooks on the execution (not sure which term is appropriate) and other non-OS libraries that are called or better dynamicly/delay-loaded during run-time by executable in question (I assume this because .pf files are created AFTER the respective process is closed and not ON or right after the execution) with regard to device, i.e. with regard to the hard-disk volume on which they reside, so it is only a some kind of map.

    Few lines from AntiVir’s “AVGUARD.EXE-17927959.pf”:

    AVGUARD.EXE
    \DEVICE\HARDDISKVOLUME2\WINDOWS\SYSTEM32\NTDLL.DLL
    \DEVICE\HARDDISKVOLUME2\WINDOWS\SYSTEM32\KERNEL32.DLL
    \DEVICE\HARDDISKVOLUME2\WINDOWS\SYSTEM32\UNICODE.NLS
    \DEVICE\HARDDISKVOLUME2\WINDOWS\SYSTEM32\LOCALE.NLS
    \DEVICE\HARDDISKVOLUME2\WINDOWS\SYSTEM32\SORTTBLS.NLS
    \DEVICE\HARDDISKVOLUME2\PROGRAMS\AVPERSONAL\AVGUARD.EXE
    \DEVICE\HARDDISKVOLUME2\WINDOWS\SYSTEM32\WS2_32.DLL
    \DEVICE\HARDDISKVOLUME2\WINDOWS\SYSTEM32\MSVCRT.DLL
    \DEVICE\HARDDISKVOLUME2\WINDOWS\SYSTEM32\WS2HELP.DLL

    regards, Ivan Tadej

    P.S., Sorry for my somehow much too long signature in the other comment (I did that totally by mistake, i.e. a copy/paste “fault”):

    Ed Bott: Why I don’t use registry cleaners

    http://www.edbott.com/weblog/archives/000643.html

  13. Ed,

    Thankyou for clearing this up. I was able to test this by simply using a stopwatch and found that the applications which had their associated .PF deleted took anywhere from 50-100% longer to startup.

    One of the Utilities I recommend in my Optimize XP Guide

    http://mywebpages.comcast.net/SupportCD/OptimizeXP.html

    CCleaner has recently been suckered in by this myth and added “Old Prefetch Data” as a cleaning option. When run it simply deletes .PF files that are over 2 weeks old based on their creation date. You can clearly see how this will cripple all of your applications startup times.

    I have tried in Vain to get them to change it but they simply will not listen and delete or lock any thread I start on the topic in their forums. They do not even allow anyone to explain how it works. I had no choice but to add a warning to my guide. Any assistance in this matter would be greatly appreciated!

    http://www.ccleaner.com/

  14. I do not use Prefetch, in fact I remove as much useless junk as I can from Windows using nLite anyway, so prefetch isn’t even possible to run on my system, the Task Scheduler was removed.

    What I want to know is what spec are you guys running? You’re saying that your programs open slowly without prefetch? Then get a faster computer. Surely that’s the answer? I use a “comfortably” overclocked Athlon64 system with 1 GB of RAM @ 2-2-25 1T timings, and the program that takes the longest to open is Photoshop. It takes about 5 seconds. Not exactly a long time to wait, is it. Everything else opens as soon as I click it, pretty much. Firefox takes about 2 seconds. If I close it and reopen it later, it’s instant. Do I need prefetch? No way. It’s not worth leaving the Task Scheduler service running on Auto for.

    When I first disabled Prefetch, my system booted MUCH faster. I have been disabling Prefetch since I was using my old Duron 1100 system in 2002. I didn’t need Prefetch then and I certainly don’t need it now. If you have a weak, old system, thenm maybe Prefetch is a good thing for you. On modern hardware, it’s less needed, so I disagree with your article because Prefetch depends on the system spec. :)

  15. *2-2-2-5, not 2-2-25. Sorry.

  16. Sorry to be posting multiple times, but I’d say if you want a fast XP, disabl as much Microsoft crap as possible. Disable all the silly fading effects, use a small, fixed pagefile, disable as many things as you can that are not needed. Use nLite to rebuild XP with the programs, drivers, and all the functionality that you need. Use Bold Fortune’s forum guides to strip XP of junk, optimize everything. My WINDOWS folder is ~ 300MB after following his guides = much less to defrag, much less to deal with. Using nLite, my last XP ISO was 125 MB after I stripped out what I don’t need. I still have all the functionality that I need personally. That’s fully service packed with SP2 streamlined and RyanVM’s Update Pack 1.3.1 which includes all the latest Windows updates. SP2 alone is 266MB. XP Pro without any service packs is 484MB. Again, my entire XP is 125 MB. That shows how much junk there is in this OS.

    I have never seen anyone with a faster Windows XP Pro than mine, and I would like to apologize for blowing my own trumpet when I say that. People’s computers are generally treacle slow, and using my own highly-tweaked machine (done with a single, large registry file and various.vbs scripts to apply all tweaks at once) feels like heaven.

    OK, I’ll shut up now.

    Regards,
    Dee (a/k/a ninjastyle on forums.amd.com, if you wanna discuss anything).

  17. Dee, if I were to use a “small, fixed page file” as you recommend, several programs I rely on wouldn’t work (VMWare is one), and my system would slow down alarmingly when I put it under peak load.

    Also, when I add up the milliseconds I might save by using your tweaks versus the hours it takes to implement them, plus the potential troubleshooting time if even a single thing goes wrong, I find the benefits not worth it.

    My XP system is mostly stock, and it’s more than fast enough for me. I understand why hardcore gamers get obsessive about tweaking, because their needs are specialized, but for most people the urge to tweak usually causes more problems than it solves.

  18. Dee,

    It doesn’t matter how new your computer is, prefetching will improve application load times.

    “When I first disabled Prefetch, my system booted MUCH faster.”
    -I’m sorry but that is a lie. I work for a system OEM and have tested prefetching on all types of PCs and it always helps performance, period.

    “done with a single, large registry file and various.vbs scripts to apply all tweaks at once)”
    -These are very dangerous as they include alot of Mythical Tweaks: http://mywebpages.comcast.net/SupportCD/XPMyths.html

    “Use Bold Fortune’s forum guides to strip XP of junk, optimize everything.”
    -This is a really, really bad idea, that guy posts alot of bad information that is simple not accurate. You can start with his cleaning the prefetch folder advice.

    Dee, I am with you on your quest for speed but understanding how something works is the first step to optimally tweaking your machine. Prefetching flat out works and should be enabled.

  19. Well Dee…

    1. First off, you said that: “It’s not worth leaving the Task Scheduler service running on Auto for.”

    I am asking you why disabling the Task Scheduler service, if it consumes virtually no CPU cycles. It only does when it’s called into action, and that’s probably less that 1 % of CPU. Also, it runs in an always running process (“svchost.exe”, beside many other services), so there is no additonal process running if it’s left to run, i.e. not disabled.

    This reminds me on the BlackViper’s Windows XP Services Guide and all the prattle about how “disabling services speeds-up computer enormously”, debunked often at ArsTechnica forums where I participate (btw. my nick is “shirker” there), i.e. it’s simple as that:

    If a service is not being used, it will use no CPU time, while regarding the used memory; Windows will reclaim its memory as needed, so until then it effectively uses no memory either.

    2. Secondly, you wrote that: “When I first disabled Prefetch, my system booted MUCH faster.”

    I am asking you how come, if the Prefetch feature set to prefetch “Boot File launch” (value “3″ for “EnablePrefetcher” entry under “HKLM\…\PrefetchParameters” key) itself optimizes the boot procedure or at least parts of it (I guess it’s the “NTOSBOOT-hash.pf” file) ??

    Do yo think that Microsoft would implement an option that supposedly does something, but in reality it does the opposite ??

    regards, Ivan Tadej

  20. Robert on October 4, 2005 at 8:23 am said:

    This site is likely too advanced for this novice, but I got on it by trying to find how to access GoogleEarth after downloading it to my computer. When I finally found it, the usual “microsoft cannot access this file…” appeared, letting me know that GoogleEarth is in my prefetch file(something that I’d never heard of).
    It turns out that it’s in there multiple times because each time that I couldn’t call it up I (foolishly) downloaded it again!
    Any help out there for old luarc@msn.com?

Comment navigation

 

Post Navigation