Switching off Windows Virtual Store

registry

cs CZE

Windows File System and Registry Virtualization (Virtual Store) is a technology to provide backward compatibility for legacy applications, which require unlimited access to system locations like “Program Files” or “Windows” folders, “Local Machine” registry, etc.

Unfortunately, this technology can significantly affect the performance of applications, therefore it can help to disable it in some cases, if we do not anticipate any legacy application requiring it.

The costs of Windows Virtual Store

The write access to important system locations it is no longer allowed under Windows 7 and newer even for Administrator accounts, as such attempts are blocked by UAC. The Windows Filesystem/Registry Virtualization helps to mitigate possible issues of legacy applications by redirecting those writes into the current user profile directory and/or user registry.

The redirection is however not for free and it can have significant performance consequences also for applications which do not actually need it. One such example is Git and GitBash shell emulation, which performs pretty poor with the Windows File/Registry Virtualization enabled – see e.g. here:

  • Git/Bash is extremely slow in Windows 7 x64 (the post actually states that it should no longer be necessary with the newer Git versions, however according to my experience, disabling the Virtual Store still significantly improves the speed of Git and GitBash commands, especially if executed as part of Git commit hooks)
  • Msysgit bash is horrendously slow in Windows 7
  • experienced the same issue with the Windows GCC port (MinGW) running sub-optimal (not running full speed even with parallel make)

This is especially a bummer if you do not use any application which needs the Virtual Store. Moreover, applications which do not actually need the Virtual Store but do not have the security manifest embedded ([3], [4]), will still go through the compatibility check calls, rendering the application to run horrendously slow under circumstances (e.g. when called repeatedly in a loop).

Note that even for reads, if the application does not have the manifest, even for any reads from system locations/registry, the Windows first needs to check whether the file/registry key exists in the Virtual Store location.

Disabling the Filesystem/Registry Virtualization

There are two registry keys to disable the Virtual Store. Each of them should work on its own, but I generally use both to make sure everything is disabled:

  1. Disabling the Virtualization in the Policies ([1]):
    • registry key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System
    • create/update the DWORD value “EnableVirtualization”, set to “0”
      (disables the Virtual Store functionality)
  2. Disabling the Virtual Store Windows Driver (LUAFV: LUA = UAC, FV – file virtualization):
    • registry key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\luafv
    • set the value “Start” to “4” ([2])
      (sets the service to “Disabled”, i.e. to not start automatically)

For convenience the contents of REG file for importing to the registry directly:
(create a new file with the “.reg” extension, insert the contents and double-click the file to insert into the registry)

REGEDIT4

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System]
"EnableVirtualization"=dword:00000000

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\luafv]
"Start"=dword:00000004

After finishing the setup the restart of Windows is necessary.

References

[1] UAC Group Policy Settings and Registry Key Settings
[2] Windows Service Start Key
[3] <trustInfo> Element
[4] Making Your Application UAC Aware

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s