Microsoft

SolutionBase: Increase users' icon cache size to improve Windows XP's performance

Create new registry keys to boost system performance for users who insist on saving files to the Windows desktop.

When I read John Sheesley's article "Change the icon cache size in Windows XP Pro," I immediately began implementing the technique on many of the Windows XP workstations that I support. Even though I've been extolling Windows XP's Start menu as the best place to keep shortcuts and their associated icons organized in a usable fashion, I also support users who insist on using the desktop as the primary place to store hundreds of shortcuts and icons. And of course, these same users are the ones who are always complaining about how long it takes to refresh the desktop whenever they perform any operation that requires the operating system to redraw the screen, such as maximizing and minimizing windows.

As I began implementing the icon cache technique, which requires you to add the Max Cached Icons setting to the registry and set the value to a number anywhere between 100 and 4096, I encountered several systems on which the recommended value of 2000 wasn't quite enough. In those cases, I had to launch the Registry Editor again, change the number, and then reboot again.

After performing this edit/reboot procedure several times on several systems, I found myself wishing for a better way. I then remembered an undocumented technique to add some custom options to Windows 98 systems and wondered if it would work in Windows XP. After some experimenting on a Windows XP system, I discovered that I could indeed add the various icon cache size settings to the Advanced Settings section of the Folder Options dialog box, allowing me to test the various sizes simply by selecting an option button and clicking OK. Here's how it works.

Note: Editing the registry is risky, so be sure you have a verified backup before making any changes.

Procedure overview

As I mentioned, this technique relies on an undocumented internal data schema that Microsoft added to the Windows operating system in order to create the Folder Options dialog box. As it turns out, just about every option button or check box that you can find in the Advanced Settings section of the Folder Options dialog box is generated by a key and a set of values stored in the registry that follow a relatively simple pattern. By duplicating this pattern and customizing the values, it's possible to extend the tree in the Advanced Settings section of the Folder Options dialog box. In other words, by taking advantage of this internal data schema, you can create an easy-to-use interface for editing the registry.

To add the icon cache size settings to the Advanced Settings tree, you'll need to create six new keys. The first key will create a folder in the tree, and the other five keys will create radio buttons that represent each of the possible icon cache size settings. Just as with the other options in the Advanced Settings tree, double-clicking the folder will expand or hide a subtree of radio buttons.

The folder key will contain three values: Type, Bitmap, and Text. The Type value will be group, which indicates that it will be a container for other values. The Bitmap value will specify the location of the folder icon, and the Text value will specify the name that appears next to the folder icon in the tree.

Each option button key will contain seven values:

  • Type
  • Text
  • CheckedValue
  • DefaultValue
  • HkeyRoot
  • RegPath
  • ValueName

In this case, the Type value will be radio, which of course creates a radio button. The Text value will specify the name that appears next to the radio button. The CheckedValue value will indicate the setting to use when the radio button is selected. The DefaultValue value is basically a fail-safe option and will indicate what value to use in the event that Windows loses track of the custom value.

The final three values specify the location in the registry where the actual setting is stored—HKEY_LOCAL_MACHINE/Software/Microsoft/Windows/CurrentVersion/Explorer. The HKeyRoot value indicates the registry hive in which the actual setting is stored. The RegPath value indicates the path to the registry key in which the actual setting is stored. The ValueName value indicates the name of the setting that will be altered—in this case Max Cached Icons. With this in mind, let's delve into the registry.

Creating the placeholder

As I mentioned, this technique is designed to provide you with a user interface for altering the Max Cached Icons setting in the registry. You'll need to begin by creating the Max Cached Icons setting, if you haven't done so already.

To begin, select the Run command on the Start menu and launch the Registry Editor by typing regedit.exe in the Open text box. Once you have the Registry Editor up and running, locate and double-click on the key HKEY_LOCAL_MACHINE. When this key is visible, open each of the following subkeys in succession—Microsoft | Windows | CurrentVersion | Explorer.

Once you open the Explorer key, pull down the Edit menu and select New | String Value. Then, assign the new value the name Max Cached Icons and press [Enter] twice. When you see the Edit String Value dialog box, type 500 in the Value Date text box. As you may remember, 500 is the default value that Microsoft assigned to the Max Cached Icons setting and a good starting value for the placeholder.

Creating the folder

Once you've created the Max Cached Icons placeholder, you can start creating the user interface. To create a folder in the Advanced Settings tree, navigate down one key to the Advanced key. Then, right-click the Advanced key and select New | Key. As soon as the item is created, rename it IconCacheSize and press [Enter].

You'll subsequently create three string values by right-clicking inside the IconCacheSize key and selecting New | String. When you see the New Value appear in the IconCacheSize key, you can name it using the names described above. Once you name a value, press [Enter] twice—once to activate the new name and once to open the Edit String dialog box. When you're finished, your IconCacheSize key should look like the one shown in Figure A.

Figure A

You'll add three string values to the IconCacheSize key.

Creating the radio button key template

Since each radio button key has the same format and there are five of them, each with seven items, we'll make it easy on ourselves by creating a template. To do so, you'll create a key containing value names and the generic value data—you won't add the specific value data until after you have all the keys in place. Once you create the template, you'll use the Registry Editor's Export and Import features, along with quick edits in Notepad, to duplicate the template.

To begin, right-click the IconCacheSize key and select New | Key. As soon as the item is created, rename it Size01 and press [Enter]. Now use the information shown in Table A to create the seven values in the Size01 key. As you do, keep in mind that HKeyRoot value is a DWORD Value—the other six values are String Values. An asterisk in the Value Data column indicates that you'll leave that particular Value Data text box blank for now.

Table A

Value Type Value Name Value Data
String Type radio
String Text *
String CheckedValue *
String DefaultValue 500
DWORD HKeyRoot 80000002
String RegPath Software\Microsoft\Windows\
CurrentVersion\Explorer
String ValueName Max Cached Icons
Data for creating the Size01 key

When you're finished, your Size01 key should look like the one shown in Figure B.

Figure B

Your template should look like this when you're done.

Duplicating your template

Unfortunately, the Registry Editor doesn't provide a Copy command, so duplicating a certain key requires a bit of ingenuity. To implement my duplication technique, right-click on the Size01 key and select the Export Command. When you see the Export Registry File dialog box, choose a folder, name the file Size Template.reg, as shown in Figure C, and click Save.

Figure C

You'll save the file as Size Template.reg from the Export Registry File dialog box.

Right after you save the file, pull down the File menu and select the Import command. When you see the Import Registry File dialog box, locate and right-click the Size Template.reg file. From the context menu, choose the Open With | Notepad command. Once Notepad opens the file, change the key name from Size01 to Size02, as shown in Figure D.

Figure D

You'll use Notepad to edit the key name in the Size Template.reg file.

Next, save the file and close Notepad. When you return to the Import Registry File dialog box, simply double-click the Size Template.reg file. When you do, the Registry Editor imports the contents of the file into the IconCacheSize key and displays a confirmation dialog box. As soon as you click OK, you'll see the new Size02 key.

To add the rest of the radio button keys, simply repeat these steps three more times. When you're done, your IconCacheSize key will look like the one in Figure E.

Figure E

Using the duplication technique will allow you to quickly create the radio button keys.

Filling in the missing Value Data

Now that you've duplicated the radio button keys, you'll need to go back and fill in the Text and CheckedValue Value Data text boxes in each one of the radio button keys. To do so, subsequently open each one of the Size0# keys, double-click the Text and CheckedValue keys, and use the information shown in Table B to fill in the appropriate Value Data text boxes.

Table B

Key Value Name Value Data
Size01 Text 500 Icons (Default)
  CheckedValue 500
Size02 Text 1000 Icons
  CheckedValue 1000
Size03 Text 2000 Icons
  CheckedValue 2000
Size04 Text 4000 Icons
  CheckedValue 4000
Size05 Text 8000 Icons
  CheckedValue 8000
Values added to the Size01 key template

I've prefaced the 500 Icons (Default) Text Value Data setting with a space in order for it to appear in the correct order in the Advances Settings Tree.

A decimal numbering scheme?

As you can see, I've used a decimal numbering scheme, as opposed to the binary numbering scheme suggested by some. Here's my reasoning: By default, the Max Cached Icons setting is set to 500 and Microsoft recommends taking it up to 2000 when you encounter problems with icons and desktop refreshing. While Microsoft doesn't provide very specific details on what exactly the Max Cached Icons setting alters, I'm assuming that since they're using a decimal numbering scheme, coupled with the name they've chosen, the value specifies the maximum number of icons that can be stored in the cache. (Keep in mind that the cache stores all the icons being used by the operating system—not just those on the desktop and Start menu.)

However, Microsoft goes on to say that valid values for the Max Cached Icons setting range from 100 to 4096. As you can see, the latter value indicates a binary numbering scheme, which suggests that the value corresponds to the amount of memory set aside for the icon cache. Of course, this is a logical assumption and that's why you'll find binary recommendations for the Max Cached Icons setting.

Now, it's important to keep in mind that regardless of exactly what the Max Cached Icons setting alters, increasing its value will, of course, require more system memory.

In any case, you'll notice that I've also assumed that Microsoft is going from 500 to 2000 by doubling the value at each increment—i.e., 500, 1000, 2000 and so on. I've even taken the doubling scheme one more step and provided an 8000 Icons setting, which breaks the upper limit that Microsoft specifies, but I've found that it seems to work fine. There's also a 500 Icons setting, so you can easily revert to the default setting if you so desire.

Changing the icon cache size setting

Once you've filled in the Text and CheckedValue Value Data text boxes in each one of the radio button keys, you can close the Registry Editor. Now, launch Windows Explorer, pull down the Tools menu, and select the Folder Options command. When you see the Folder Options dialog box, select the View tab, and look at the Advanced Settings tree for your new configuration options. It may help if you double-click the Files And Folders branch to contract it, as shown in Figure F.

Figure F

You can now easily experiment with the various icon cache size settings.

That's all there is to it!

As you can see, you can now choose any of the various icon cache sizes simply by selecting a radio button and clicking OK. When you do, the Max Cached Icons setting in the HKEY_LOCAL_MACHINE/Software/Microsoft/Windows/CurrentVersion/Explorer section of the registry is altered accordingly. As I mentioned, you still have to reboot the system in order to activate the new settings, but the operation is a lot more streamlined.

About Greg Shultz

Greg Shultz is a freelance Technical Writer. Previously, he has worked as Documentation Specialist in the software industry, a Technical Support Specialist in educational industry, and a Technical Journalist in the computer publishing industry.

Editor's Picks