Tip of the Day Blog
    The Web
« TrailLink | Main | Bike Brake Tip »

Windows Compression

From Lockergnome:

I am running Windows 2000 and I am wondering if I should run the Disk Cleanup (compress old files). It is currently taking up 14372KB of space.
Should I compress old files?

While you’re only asking about Disk Cleanup, I’m going to talk about Windows File Compression in more general terms. Using file compression to save space is nothing new, even when it’s native in the file system used by Windows. But it’s not necessarily a slam dunk.

In fact, without knowing more, I get to use all of my favorite answers:



It depends.

After you’ve finishing beating your head against the computer, read on, and I’ll explain why.

Windows File Compression is a part of the NTFS file system that when enabled, automatically compresses files to take up less space. Seems simple enough, right?

As a gross oversimplification compression means replacing one representation of data with another that takes up less space. For example the string “**********” (10 asterisks) might be replaced with three characters - “10*” - meaning “ten asterisks.” When decompressed the “10*” would get transformed back into “**********.” Now, of course there are complications - for one example we need a way to make sure that if there’s a “10*” in the data before compression we don’t try to turn it into “**********” on decompression.

Suffice it to say that real compression algorithms are a complex technology, bordering on an art form.

So if good compression can “makes things smaller,” what’s the catch?

In my opinion, there are two big ones.

Compression is Work - One thing that they all compression algorithms share is that they require calculation. That means when you compress or decompress a file on your computer, your CPU needs to do more work than if the file were not compressed. Different algorithms have different characteristics - some require a great deal of CPU processing to compress the data, while the decompression can be lightning fast. Others compress comparatively poorly, but take less time to do it.

Compressing files that are already compressed doesn’t help. - A file that has already been compressed by a reasonably good compression algorithm will typically not compress well if you try to compress it again with another. In fact, in the worst case, a “compressing” a compressed file can sometimes even make it bigger. And here’s the catch within the catch: many files you use ever day are already compressed. Typically audio, video and image formats are already using compression algorithms as part of the file format. “.mp3,” “.jpg,” “.mpg” files, and similar, are all already compressed, and typically to not benefit much from attempts to compress them further.

So what should you do? When should you consider compression?

I’d consider the following:
  • If the files you’re considering compressing are used infrequently, then they might be candidates. The “old files” from a disk cleanup utility probably fall into this category.
  • If the files you’re considering compressing aren’t already compressed, then it could make sense. There’s no way for me to know what files disk cleanup is pointing you at, so I can’t say how this might apply to you.
  • If you have a powerful enough CPU, you can compress files used more frequently. I definitely wouldn’t compress files I use frequently on an older machine. It can slow down your machine as the CPU gets more involved in every disk access.
  • Realize that compressed files and compressed file systems are harder to recover in the event of a crash. Make sure that you’re appropriately backed up.

My advice? Don’t bother. Compression on average will probably recover only about 50% of the space used by files you compress. If you’re really running into space problems that have you looking at this, you’re probably better off adding a hard drive to your system.

I have no compressed file systems on any of the computers I run. I’ve done so in the past only on laptops where adding or replacing a hard drive just wasn’t in the cards for me, and only after I’ve started to run out of space and other options didn’t free up enough.

If you want to investigate file compression further, note that when using NTFS compression is not all-or-nothing. For example you can select which folders should be compressed. Just right click on the folder in Windows Explorer, select Properties, and on the General tab, click on Advanced. There you’ll see Compress contents to save disk space. Select that and the folder and optionally all folders within it will be compressed and all further files placed in those folders will be automatically and transparently compressed. Don’t do that to active folders, such as C:\Windows or c:\Windows\System32 for example, because it’ll adversely impact your performance. But if you have large collections of data that aren’t already compressed, and aren’t used that frequently, and your CPU won’t get in the way, it might be an option.

And in the long run, allowing your disk cleanup utility to compress old files likely won’t hurt. It probably just won’t get you a lot either.

EmailEmail Article to Friend