31

Since the Windows XP days, Windows Installers (.msi files), including InstallShield installers (which is just a bootstrap for MSI) has taken around five times longer to uninstall an application than other installers. The same is also usually true about installing.

Why do they still take this long, and why do people still use MSI for installing? For example:

Uninstall VLC - takes around 5 seconds.
Uninstall XYZ - launches "Preparing to remove..." followed by a 15 second delay.

All it's doing is removing files and cleaning the registry (which may include COM registrations), so why does it take so long?

5
  • I just want to note, this is only true if you (1) disable the system restore checkpoint feature, and (2) it's a gigantic installer (which is not unique to Windows Installer -- I've seen lots of slow Inno installers, simply because they're huge). I've had Windows installers install and remove themselves in (literally) a handful of seconds. (For example, Bootvis installs in 3 seconds on my system. It uninstalls in the same amount of time. And no, my system isn't blazing fast either.) The difference is that Windows Installer has a lot more features, so larger programs use it more often.
    – user541686
    Nov 1, 2011 at 3:25
  • @Mehrdad did you mean (1) enable system restore?
    – Chris S
    Nov 1, 2011 at 11:48
  • Indeed yes, typo.
    – user541686
    Nov 1, 2011 at 15:59
  • 3
    I came here because MSI uninstall was taking forever... and actually the reason was that the pop-up Do you want to allow the following program from an unknown publisher to make changes to this computer? was hiding in the background. Sep 30, 2013 at 8:12
  • See this answer for technical details for speeding up MSI installations: superuser.com/a/296534/11906 May 13, 2014 at 0:21

4 Answers 4

33

Windows installer first systematically creates a system restore point, which is a quite slow operation.

Also from the article entitled, appropriately, "Windows Installer sucks", an excerpt:

It used to be that installation would consist of a program executing and taking a few simple steps to install your software, then do the reverse on uninstallation.

That's not how Windows Installer works. Instead of running a program to simply install and let it be done with, it examines the state of your system, then examines the state of the database that is the program's installer, then does a series of overcomplicated calculations about how to reconcile the two.

It seems that, instead of running an installation script, it goes about solving a traveling salesman problem. Which is why it runs so slow. Or at least, that's my impression.

I also add that Windows installer keeps all information in the registry, which is not the world's fastest database.

2
  • 5
    It's probably faster than what dpkg uses for its package database (though, admittedly, dpkg doesn't store everything in it): /var/lib/dpkg/status is a flat text file which lists every single package that was once installed, and has not since been purged -- and I'm not even sure it always omits the purged ones.
    – SamB
    Dec 10, 2010 at 22:12
  • 3
    dpkg doesn't lie to me with progress bars that say "Time Remaining: 0 seconds" for two minutes, though ...
    – LawrenceC
    Feb 8, 2014 at 14:31
20

Windows Installer indeed has a reputation for being slow. There are a few things that contribute to this and I'm going to address them below. But ultimately, one should ask themselves if one, two, or three minutes is really a matter of contention when installing and uninstalling software. I take more time than that flipping through TV channels :)

The Registry
This is the culprit number one. Windows Installer makes heavy use of the registry for its operations. As your system matures, as you install and uninstall applications and as the registry grows in size or becomes fragmented, MSI will become slower. The same application will install and uninstall much faster on a pristine Windows installation, than it will on a matured system. The solution here is to try and keep the registry clean and defragmented.

For registry cleaning, use one of the many tools available out there. But for registry defrag I cannot recommend enough NTREGOPT for internal hive optimization and PageDefrag for physical file defragmentation.

The reason MSI operations may become slow on the registry has to do with how MSI uses it. Windows Installer uses the registry to keep track of which Products have installed which Components and to which Location it was installed. The original installation GUIDs are used in compressed format. Per-machine information about installs can be found at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18, whereas per-user data is found next to it on a under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\ and on a key with the user SID.

Both these keys can be quite large and contains numerous subkeys and values. They control Products, Components and KeyPaths of each installed application. All this information must be read and processed for a correct uninstallation procedure. However the registry format lists keys in alphabetic order which allows for binary searches. But the values are not. They are stored as they are created, so a linear search procedure must be performed. Which slows down the algorithm performance.

All in all, MSI is a rather complete and accurate method for installation and uninstallation of software. But it suffers from its registry dependency. The system is excellent. It is the Windows registry that should have had its overhaul a long time ago :)

For more advanced information:
For a deep analysis of what MSI is doing during each install or uninstall procedure, refer to this article that explains how to setup MSI Debug. Or, for less but still valuable information, this one one how to activate logging.

4
  • 5
    Also, as far as I know, MSI uses transactions for everything it does so it can always do a proper rollback whenever an operation fails. This probably also doesn't contribute to speed but is quite essential for data integrity. (I stopped counting how often I needed to clean up after an NSIS installer failed -.-)
    – Joey
    Sep 19, 2009 at 20:56
  • Right now, I'm installing OpenOffice and it has already been almost an hour ;)
    – Quiark
    May 26, 2010 at 18:24
  • Very informative. I for one seem to get "Cannot create restore point" errors often (maybe restore point quote reached?) in my msi logs, so the creation of restore points does not get the chance to hinder my install times. Regardless, my install times are still slow, and if value look-up is as slow as you say, I suppose there isn't any reason on Microsoft's part to provide an additional implementation for extra leaf/node information in the registry's binary specification to supplement binary searching.
    – chaz
    Feb 4, 2013 at 0:18
  • > But ultimately, one should ask themselves if one, two, or three minutes is really a matter of contention when installing and uninstalling software. Yes. Mar 3, 2013 at 6:04
6

Windows installer has many big advantages for corporate deployment, some of which I have described here: https://serverfault.com/a/274609/20599

Much of the slowness of a Windows Installer session is due to its rollback capabilities. Firstly it creates a restore point prior to install or uninstall (provided system restore hasn't been disabled). Then it will back up all affected files during both uninstall and install to ensure that the system can be restored to its original state should an error occur.

Another contributing factor is that all components in the MSI will be registered in the registry. This involves some overhead.

For compiled MSI files some time is also needed to extract the install files.

See this answer for technical details for speeding up MSI installations.

3

Windows Installers are so commonly used for many reasons - operating system integration, security policies, unattended installations, and much more.

The most common reason I can think of is the unattended installations, and network distributions. Large corporations can easily distribute applications, by having the .MSI file on a network drive, and then just calling a batchfile (or distribution wizard application) on a remote machine to automate the install process.

While other options exist outside of the .MSI files, there are some unique features which integrate with most versions of Windows that a lot of other installers don't have.

And just so you know - InstallShield is not always a front-end to MSI files. They also have their own proprietary installation solution.

3
  • 1
    The question was about why does MSI take so long to do something, compared to pure .exe installers. Sep 19, 2009 at 12:31
  • 5
    From the question... "and why do people still use MSI for installing?" Sep 19, 2009 at 12:40
  • @grawity: technically, msi installers can be packaged in exe's too, but that's probably splitting hairs. Jun 13, 2011 at 22:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .