Does deleting temporary files really speed up your computer? (Windows)

8

5

You've most certainly read it on the internet, and you may have even heard other supposedly computer-savvy people suggest that deleting temporary files speeds up your (Windows) computer.

But how does that actually work? Drawing on my limited theoretical knowledge of file systems and disk drives, I cannot understand how deleting temporary files should improve file system performance unless the disk is nearly full. How can a temporary file that just sits there impair performance? Can somebody offer a technical explanation of why deleting temporary files (and cookies, and prefetch files) should or shouldn't have an effect on performance?

Edit: It appears that Microsoft thinks so.

InvalidBrainException

Posted 2011-10-24T05:43:49.787

Reputation: 731

5Since I haven't "read it on the internet", please provide some links. – sawdust – 2011-10-24T05:53:45.017

A quick search yielded these results. Plenty of people seem to think that deleting temporary files speeds up your computer. Even a Microsoft page suggests so! But I have a hard time understanding exactly how a file that just sits there doing nothing can impair performance (unless in the case of very limited storage space).

– InvalidBrainException – 2011-10-24T07:44:51.443

1@Terribad: you might want to include the links directly in your question, to prevent further upvotes of the above "please provide some links" comment – Rabarberski – 2011-10-24T07:59:21.303

@Rabarberski: Ha ha, point taken. I assume that most Windows "super users" have tried to perform some sort of optimization on their computer, and in attempting to do so have used Internet search engines for relevant information, and in doing so have encountered common Windows maintenance advice such as "delete your temporary files". :) I chose not to provide links in my original question because there are so many relevant websites for the world's most popular operating system, but I suppose I should include the Microsoft link since it is presumably more authoritative. – InvalidBrainException – 2011-10-24T10:49:14.160

Answers

8

I can certainly vouch for the speedup associated with having a huge number of files in your temp folder. I've had my current laptop for 2-3 yrs and never deleted temp files... then one day I installed AVG PC-Tuneup and inadvertently deleted my temp files (the UI sucks). Wham! Actual, percievable speedup.

I can think of a few reasons for why:

1) NTFS has to make 8.3 filesnames for every file (unless you tweak it via fsutil). Its gets progressively harder once your folder has a large number of files. Also applications that make the temp files, have to search for a unique name. I had a pokey old 4200 rpm drive, so each seek was very expensive, and lots of seeks were needed because (see point2)

2) Size of the MFT. The Master File Table can become many hundreds of MB in size and won't be cached as often (or atleast more of it will pbe paged out all the time). ntfsinfo from Sys Interals will give you the deets...

3) Each time the temp folder is enumerated - there's a lot more work to be done - esp. if you have a virus scanner that checks all the files in a folder, each time the folder is enumerated! I'd also been very aggresive with Windows Search indexing. Excluding the temp folder from the index, helped speed-up my computer too...

Grynn

Posted 2011-10-24T05:43:49.787

Reputation: 356

Definitely, having Microsoft Endpoint protection and deleting system temp files is needed at least every month! Allways very significant speedup. The slowest part of the system is the HDD if you do not have latest SSD. – Vojtěch Dohnal – 2015-04-01T08:52:53.530

1>

  • if you don't disable this. 2,3) yes! it is ALWAYS enumerated and folder hash always is in memory.
  • < – Eir Nym – 2011-10-24T11:03:55.833

    1

    While I think the performance increase is fairly small, I see two reasons why it could make a difference:

    • It decreases filesystem fragmentation. Edit: or quite the inverse? see comments
    • It could speed up temporary files scanning and creation for some programs. Some programs create consecutively numbered files (file001.tmp, file002.tmp, ...) in the temp folder, but in order to find out the latest number some simple/stupid approach might be to try each number in order, until a filename is not yet taken. I assume this process takes some time (8 msec for a disk seek according this perhaps outdated reference) if you've accumulated a few years of temporary files.

    Rabarberski

    Posted 2011-10-24T05:43:49.787

    Reputation: 7 494

    1I think I understand your second point, but doesn't file deletion actually cause fragmentation? And even if it did decrease the fragmentation, or have some sort of other tangible performance, why would the effect be any different than if you deleted other files outside the temp directory? – InvalidBrainException – 2011-10-24T10:58:24.460

    Hmm, good point about deleting the files actually /causing/ fragmentation! – Rabarberski – 2011-10-24T13:44:50.937

    0

    I agree with Grynn, but have another thing to consider. With the fact that the more data stored on HDD (not mention SSD here) the slower the read/write becomes, it's clear that PC with hundreds GB of data should be slower than one has a fewer data. Also, if the PC has AV software, it will usually scan for data on the disk, each time of boot or some scheduled time. Windows has a feature named "Index" to make the file searching gets quickly, it might affect the performance too if users has lots of temporary files too (though I think Index will ignore the temp folder). But I believe that the reason is related to the physical properties of HDD more than OS and software.

    Feliks

    Posted 2011-10-24T05:43:49.787

    Reputation: 1

    0

    Yes, regularly deleting temporary files does speed up your computer, but the "amount of speed up" depends on memory, processor and how often is this folder used.

    On my old computer I did this every week, on my current one - once a month or two. (Yes, I have an antivirus software.)

    More important is that the trash bin should be empty or almost empty.

    Eir Nym

    Posted 2011-10-24T05:43:49.787

    Reputation: 377

    Stating that 'it is more important to empty the trash bin' is a variant on the original question. Why would an empty trash bin be good for performance? Any pointers would be interesting. – Rabarberski – 2011-10-24T13:47:25.783

    Explorer and antiviruses always keep it in mind. With icons, and other information – Eir Nym – 2011-10-24T13:57:20.490