Fixing KeePass' Slow Startup Performance
If you don’t use a Password Manager to store your login information for websites, first go read this: http://www.troyhunt.com/2011/03/only-secure-password-is-one-you-cant.html.
I’ve been using KeePass for my password manager for years, but noticed that their Professional Edition had a pretty brutal startup delay. As in – launch KeePass and wait 80 seconds for the window to open. While password security is important, that kind of delay will make even the most security-conscious person start thinking about using ‘123456’ for their password instead.
Surprisingly, I hadn’t seen many complaints online (and certainly no solutions), so I decided to see what Process Monitor might say. After setting an application filter for ‘keepass.exe’, here was the answer:
At 7:14 and 10 seconds, it starts enumerating the files in the directory where it is installed. And then doing this for every subdirectory. On my machine, that results in processing over 1600 files – as it was a random ‘Tools’ directory with all kinds of junk and support files.
At 7:14 and 55 seconds, it finally completes. And then creates a PluginCache file.
If I were a betting man, I’d say that it was looking at each of those 1600 files trying to figure out if they were some sort of KeePass plugin or not. Which takes a long time. This seems even more likely when you load the program a second time. It doesn’t take nearly as long to start because computers are quicker to read files a second time with the assistance of filesystem and hard drive caches.
Fortunately, this is simple to verify:
After rebooting to clear the caches (there are more elegant ways), our suspicions are confirmed. Only 2 seconds to launch – the highlighted line is when Keepass brought up its UI:
So there are two solutions:
Disable Plugins
If you don’t need plugins, you can just disable them.
Move KeePass
If you need / want plugins, create a subdirectory in your Tools directory for KeePass. For example, c:\Users\Lee\Tools\KeePass. When KeePass launches, it will still scrub through that whole directory and its subdirectories – but there will only be a few files there. Then, put a launcher script in your Tools folder:
:: keepass.cmd
start %~dp0\keepass\keepass %*