Cleaning the Windows registry – and optimizing

Last Updated on April 26, 2017 by Dave Farquhar

Cleaning the Windows registry is a popular and controversial topic. Many pundits tell you never to do it. When I wrote a book about Windows back in 1999, I dedicated most of one chapter to the topic. But today the pundits have a point. Most registry cleaning utilities do much more harm than good. I don’t recommend you clean your registry, per se, but I do recommend you maintain it.

I don’t want to dismiss the concept completely out of hand. There’s a difference between a bad idea and a bad implementation. Registry cleaning and maintenance is a victim of bad implementation. But that doesn’t mean it was a bad idea. So let’s talk about how to get the benefit while minimizing the drawbacks.

Registry cleaning theory

The theory behind cleaning the Windows registry is that programs dump clutter into it and don’t clean up after themselves when you uninstall them. So the registry gets bigger and bigger and your computer gets slower and slower. That’s the theory.

In practice, since the registry is a database, the computer can ignore most of the clutter. So a bit of unused junk in the registry doesn’t really make much difference. Back when we measured CPU speed in megahertz and 32 megabytes of memory was extravagant, we could notice the difference. In the late 90s when I was trying to extend the lifespans of sub-100 MHz computers, every little thing helped, and this was one of them. Today? Not so much.

The danger always was that a registry cleaning utility would delete something that another program actually needed. That’s the dangerous balance. And a registry cleaning utility really needs to be aggressive to get people to use it. The program that dumps 1,000 keys must be a lot better than the one that only dumped two. Right? It would seem that way, but when you dump 1,000 keys you’ll probably do more harm than good. In practice, that’s typically what happens.

I used to recommend Ccleaner’s registry cleaner portion. In the Windows XP days, it was pretty effective. But it can damage Windows 10 systems, so if you’re going to try it out on your Windows 10 system, make sure you create a restore point first. If you don’t know how to create a restore point, you probably don’t need to be messing with registry cleaners.

Getting most of the benefit with lower risk

You can get most of the benefit of registry cleaning by using a more aggressive uninstaller than the one built into Windows. The more aggressive uninstaller will leave behind fewer orphan registry keys. Revo Uninstaller is a popular example.

That said, be aware that the more aggressive uninstallers aren’t risk-free. I ran into a problem at work one time when we found an unlicensed copy of a particular piece of software. Add/Remove Programs failed to remove it, so we tried to use Revo Uninstaller to uninstall it. It did uninstall, but other software from the same manufacturer stopped working and we had to reinstall quite a bit of stuff to get the system working again.

So be aware. You can probably use Revo Uninstaller and not have anything bad happen. But it’s not something I’d bet my career on. I have bet my career on some things before, but I won’t bet it on that.

What the registry needs more than cleaning

Garbage data doesn’t slow the registry down nearly as much as empty space does. Even in the 90s, compacting the empty space gave me more benefit than cleaning did.

Microsoft frowns on registry cleaners in general, and in Windows 10 especially, they seem to do more harm than good.

Drag this setting all the way to the bottom before running NTregopt, then drag it back to the middle when you’re done.

When it comes to optimizing the registry, I found NTregopt to be helpful. It doesn’t actually drop anything from the registry. It removes slack space and rebuilds it. It’s very similar to the maintenance I do to the database that runs behind this particular web site to keep it fast.

But you have to disable UAC, an essential security feature, for it to work in Windows 10. Be sure to change it back afterward. Click Start, type Change User Account Control Settings, launch the app, slide the slider all the way to the bottom, then click OK. Then run NTregopt. Ignore any errors you get, and reboot when it asks. When it finishes, it will tell you how much empty space it removed, and ask you to reboot. You have to reboot for the changes to take effect. After you reboot, Click Start, type Change User Account Control Settings, launch the app, slide the slider back to the default (the thick line in the picture above), then click OK.

Defragmenting the registry 

Like any other file, the registry can become fragmented and that hurts overall performance. Normal defragmenters can’t touch the registry because it’s always in use while the system is running.

The open-source tool Ultra Defrag has the capability to defragment the registry, page files, and other system files at boot time on 32- or 64-bit systems.

To defragment the registry and other in-use system files at boot, launch Ultra Defrag, then navigate to Settings -> Boot time Scan and choose Enable.

The next time you reboot, Ultra Defrag will defragment your page file, your hibernation file, your registry, and your Windows system files. It may take a while, but you can tweak it to leave stuff out if you want. It won’t run on subsequent reboots unless you launch it again.

If you only want to defragment the registry, launch Ultra Defrag, hit F12, and then replace what comes up with this and save it:

@echo off
;--------------------------------------------------------------------
;                UltraDefrag Boot Time Shell Script
;--------------------------------------------------------------------
; !!! NOTE: THIS FILE MUST BE SAVED IN UNICODE (UTF-16) ENCODING !!!
;--------------------------------------------------------------------

;set UD_IN_FILTER=*windows*;*winnt*;*ntuser*;*pagefile.sys;*hiberfil.sys
set UD_IN_FILTER=system.*;sam.*;ntuser.*;security.*;software.*;default.*
set UD_EX_FILTER=*temp*;*tmp*;*dllcache*;*ServicePackFiles*

; to exclude archives too uncomment the follwing lines
; set UD_EX_FILTER=%UD_EX_FILTER%;*.7z;*.7z.*;*.arj;*.bz2;*.bzip2;*.cab;*.cpio
; set UD_EX_FILTER=%UD_EX_FILTER%;*.deb;*.dmg;*.gz;*.gzip;*.lha;*.lzh;*.lzma
; set UD_EX_FILTER=%UD_EX_FILTER%;*.rar;*.rpm;*.swm;*.tar;*.taz;*.tbz;*.tbz2
; set UD_EX_FILTER=%UD_EX_FILTER%;*.tgz;*.tpz;*.txz;*.xar;*.xz;*.z;*.zip

; uncomment the following line to create debugging output
; set UD_DBGPRINT_LEVEL=DETAILED

; uncomment the following line to save debugging information to a log file
; set UD_LOG_FILE_PATH=%UD_INSTALL_DIR%\Logs\defrag_native.log

udefrag %SystemDrive%

boot-off

exit

If you have an SSD, a fragmented registry hurts you a lot less. Fragmentation still slows down SSDs somewhat, but generally speaking, defragmenting an SSD does more harm than good. Defragment the registry once a year if it makes you feel better, but don’t do it on a regular basis if you have an SSD.

What else you can do

If the concept of the Windows registry is unfamiliar, I’ve explained it in more detail here.

If you’re interested in cleaning the registry, chances are you’re interested in performance in general. I’ve covered general Windows performance in a separate blog post on optimizing Windows 10.

If you found this post informative or helpful, please share it!

2 thoughts on “Cleaning the Windows registry – and optimizing

    • February 21, 2017 at 8:49 am
      Permalink

      Good point, I’d forgotten about Speedyfox since I rarely use Firefox anymore. I didn’t realize it supports Chrome now. And yes, it does indeed seem to help Chrome like it does Firefox. I’ll have to give it a try on a couple of other machines when I get a chance, and probably add a mention to the main Optimizing Win10 piece.

      Thanks!

Comments are closed.