Why does Explorer’s New menu take so long to appear the first time I open it?

Raymond Chen

Raymond

When you right-click on an empty space in an Explorer folder and select the New menu item, there is sometimes a delay of up to two seconds before the menu appears. What’s going on during that delay?

The items in the New menu are discovered by looking for Shell­New subkeys in HKEY_CLASSES_ROOT.

This search takes some time, seeing as HKEY_CLASSES_ROOT is a rather large registry key. The New menu starts a background task to collect all the information and waits up to two seconds for it to report results. If the task doesn’t finish within two seconds, then the New menu gives up waiting and merely shows the result from the previous time the task ran, hoping that no new items were added in the meantime.

Meanwhile, the task continues to run and eventually completes with a list of items. If it finishes in time, the New menu will use it right away. Otherwise, it is saved for the New menu to use next time.

This is the similar sort of nonsense we went through with the COM component category catalog.

Raymond Chen
Raymond Chen

Follow Raymond   

13 comments

Comments are closed.

  • Avatar
    George Gonzalez

    Yeah, every time I wait for that menu to appear, I think:  The first computer I worked on had a 80KHz basic instruction time.  This one runs at 3.2GHz  with six cores.  Two seconds on this one is the equivalent of about two million seconds on that first CDC 160A.  That would be like very roughly 23 days to wait for that menu.  Good thing it didn’t have a registry!

    • W S
      W S

      The new menu was probably faster on Windows 95 than it is now, back then HKCR did not have that many keys. .NET dramatically increased the number of keys and WinRT has also contributed a bit.

      • Avatar
        cheong00

        Yup. Those were the days when the whole config folder was under 10MB in size, now the SOFTWARE registry file has over 200MB, way bigger than my first harddrive.
        (I know the files in config folder is just only part of the registry, just quote that for size comparison purpose)

  • Avatar
    Steven Don

    What is meant by “the first time”? The first time in an Explorer session? The first time in a given folder? The first time during the time the Explorer context menu is open? A simple test I just did implies the latter.
    I admit to getting a little annoyed when I just want to create a new folder and have to wait several seconds for the menu to pop up. Yes, I should probably use the button in the ribbon instead, but it is hard to change the muscle memory.

    • Avatar
      Ji Luo

      I always create a new folder with Ctrl+Shift+N… Rarely do I remember using the New context menu these days 🤔
      Raymond: Why doesn’t Explorer employ caching as it does for taskbar toolbars? Plus, Explorer can take SHCNE_ASSOCCHANGED as a hint to invalidate the cache, which, after all, should be sent after any file association data have changed (I consider everything under HCKR\.ext part of file association data).

  • Avatar
    Joshua Schaeffer

    It took me about 100-200 lines of C# to recreate the enumeration and construction of the New menu but I was hoping there was a way Windows could do it for me similar to IContextMenu. I hand you a folder PIDL/IShellItem and a menu handle, you fill it with New items, and then I tell you which command to activate. Everyone who creates their own Explorer replacement (or Open/Save As window) has the conundrum of being able to offer in-place creation of items. They all do it differently and nobody does it well.

  • Avatar
    Dmitry Vozzhaev

    And in such indices, althougo small pricks To their subsequent volumes, there is seen The baby figure of the giant mass Of things to come at large.
    You know, caching is only one of two methods to speed up lookup queries. 

  • Avatar
    "Fleet Command"

    Somehow, I don’t think you are talking about the Windows 10 v1809 bug that causes the New menu to appear after a long delay, every time. Microsoft says this issue has been resolved in 1903.

    • Avatar
      Marc K

      It is working better on 1903.  I wonder if this means Windows Server 2019 users are going to have to live with this bug for the next 10 years.

  • Avatar
    Marc K

    This is super annoying.  I’d prefer if Explorer did the scan at startup (or soon after) and then used RegNotifyChangeKeyValue to update as things change.  My computer will be running for days and I’ll still regularly find myself waiting for 3 seconds for the New menu.