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

And how does that actually work? How can a temporary file impair performance by just sitting there?

Edit: It appears that Microsoft thinks so.


Solution 1:

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...

Solution 2:

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.