Monday, September 15, 2008

Optimizing Windows performance and the Fallacy of Composition

We are all Windows Users, even the Developers among us.

Our productivity (and often our sanity) is dependent on our computers responding to our needs in a sensible time-span.

There is nothing worse than starting work on a busy day and having to wait for ages while your machine boots up, Outlook synchronises or working for hours at the limits of your machines resources.

It's worth taking some time to clean up your machine and free those resources to give you the response that you need. It may prove to be a time consuming process in itself but it is worth spending a little time to save a lot.

How do we speed up Windows?

The system memory (RAM) is the place where the greatest initial performance gains can be made. As a general rule, RAM is fast and Disk IO is slow. The management of these two components is linked. When all of the RAM is used up, the OS writes to the disk and subsequently the machine performance slows down.

There are a number of common symptoms of poor performance; slow boot time when the machine starts is a common complaint, slow running and sluggish performance, slow starting for programs, hanging applications, slow search operations, long times for synchronisation over the network and various other issues all conspire to eventually turn every machine into an experience similar to wading through chocolate.

In order to speed up your machine as much as possible it is sensible to free up as much RAM as possible in order to reduce reliance on disk IO. Then we can proceed to other bottlenecks and get your machine running as fast as (or faster than) it did when it was new.

Use the right tools for the right job

In order to really see what is happening on your system you need an application to view its activity. By far the best is Process Explorer from Mark Russinovich and Bryce Cogswell of Sysinternals, more power to their elbows...

Download and start Process Explorer from the Sysinternals web site, it's a free download. When you open it you will see what is happening under the hood. You can see each process and with some changes to the columns, which processes are using up the most system memory or IO.

In your process tree in the left hand side you will see a number of applications running. Lots of them aren't there? If you expand the System element and its child processes you will see all of the Windows Services that your machine is running. If you double-click on any individual process you will see a dialog with a variety of useful information about each process. Selecting Ctrl-I will give you the system information dialog from where you can see how much, or how little, overall system resources you have available.

To view the resource hogs, right click on the column header at the top and click Select Columns or select View-Select Columns from the main menu and from the Process Performance tab select the IO Read Bytes and IO Write Bytes check boxes. Then from the Process Memory tab select Virtual Size. There should be no need to take any action on these at this stage but it will give you an idea of what we will do during the optimization process and if at any time in the future your machine starts thrashing the hard disk or running unusually slowly then you can take a look in Process Explorer to track down the culprit.


In my experience, on a machine that has a limited amount of RAM the greatest performance gains come from removing unnecessary processes from memory. These are either unnecessary Windows Services and/or unnecessary auto-run processes.

Most Application Vendors, including Microsoft, realise that a key to application performance is the start-up process. They don't want their Users to have to wait as the application starts up, reads its settings and initializes over the network or even worse over the internet. They get around this by either producing a start-up executable that is run automatically when the machine boots or a Windows Service that is run at start-up.

This is where the Fallacy of Composition comes up. In isolation, it sounds like a great idea. Run your process when the machine starts up reducing any subsequent load time and improving the User experience. That is, until *every* Application Vendor adopts the same strategy and the User's experience becomes seriously impaired by waiting for an eternity as their machine starts up in the morning...

Unnecessary Services

So what is an unnecessary Windows Service? Its is a service that is running that you don't need. It uses up system resources that could otherwise be used by the processes that you do need. What we can do is to turn it off so that it is run when needed or in some cases turned off altogether.

In order to sort out the sheep from the goats in Windows Services we need to refer to a learned tutorial from Black Viper. On this site he explains the preferred settings for each service depending on what your needs are. You can use the MMC Services snap-in to turn off the services one by one. He also explains why the Microsoft start-up optimizer msconfig.exe is not a useful way of optimizing boot-up.

Unnecessary startup applications.

Windows provides a range of options for starting applications at boot time. The preferred option to place a shortcut in the User's startup folder but it is common to use the registry.

In order to identify applications run at start time another utility from Sysinternals, Autoruns is really useful. Running autoruns enumerates through every location on the system from where external code can usually be run including all of the common registry settings and a number of other places such as IE add-ins and so-on.

The main tab labelled "Everything" lists all of the automatically run applications. I suggest that for everything that you are not sure of you go to Google, research it and decide whether to turn it off or not. If you're unsure whether you will need the app running or not you can deselect its checkbox in the main window and Autoruns will store the information for you elsewhere to allow you to switch it off temporarily and reinstate it if you have any issues.

Unnecessary Applications

We all download and install the occasional app that we don't actually use. You should go through Control Panel>Add Remove Programs to uninstall any applications that you dont need. They use up disk space, contribute to disk fragmentation, may run and use up RAM, contribute to registry bloat and are effectively junk. Uninstall them.

Disk IO

Deleting unnecessary files

In order to delete the junk you first have to identify it. There are the files that we create, internet downloads, automatically created files and stuff that many of us don't even know is there such as our internet browsing history. Finding and deleting all of this seems like a monumental task of wading through folder after folder to find the files that are using up the most space. Help is at hand in the form of Overdisk. This cool program iterates through your filesystem and generates an interactive Pie chart of the file system that allows you to track down areas where your disk space is being used up. From there you can decide if you still want them and if not delete them.

Defragment the file system

What's left needs to be cleaned up. When Windows allocates disk space it manages the file system in small chunks. When you delete some of those files that leaves spaces which are used the next time that disk space is required. This leaves the file system Fragmented which affects performance. In order to recover that performance you need to Defragment (Defrag) the file system regularly. The best way to do that is to use the Windows Defragmenter on a regular schedule when you don't use the machine.

Network lag

Many applications, especially those with an off-line mode rely on the internet in the same way that many applications have done in the past with the network. This is more of the same Fallacy of Composition where something done in isolation causes immense problems when every application tries to do it. What this does is to extend the boot up time and the way that it does it is by extending the amount of time that start-up continues for. Applications that initialize over the internet, check for updates and so-on often wait in memory, accessing various other resources, registry and files until the application has initialized fully. Multiplied by the number of initializing applications this is a bit of a grind. One way to see which applications are hanging on to internet connections is to run the "netstat -b" command from the command line or run Active Ports which is another freebie that will give you a list of all of your open ports and the applications listening on them. From these you can decide whether some of them are strictly necessary. Be aware that many of these apps, the ones with a Remote port of are actually listening on your machine and so do not rely on internet connections.

Speeding up your search

To improve search performance use Google Desktop Search. It quietly and unobtrusively runs in the background indexing all changes to the file system. It indexes a number of file types and there are plug-ins for others. It also caches the files so that if they are subsequently deleted they can be recovered.


As the number of messages grows, so does the size of the Outlook data file that holds them. If you are unfortunate this can become huge and if it is kept on the network initialising Outlook takes forever. To resolve this archive your old email messages. You can either archive them using the archive utility in Outlook or if you want to keep them searchable you can always move them with drag and drop into appropriate folders on the the file system where they can be indexed by your search utility.

1 comment:

Anonymous said...

I agree with most of these tips. For defrag, I think better than scheduling a defrag would be to use an auto defragger like Diskeeper '09 that makes defragging a 'install once and forget' operation and this keeps the drives running smoothly all the time.