Since upgrading my system (full format + reinstall) to Windows 10, I've noticed a very uncomfortable behaviour with KeePass 2.x that is 100% reproducible. Here are the simple steps:
Launch KeePass and make sure there are database entries visible.
Drag the KeePass window partially off-screen. Some caveats:
-Make sure that some visible columns (ex. Title, User Name, Password, etc.) are off-screen or partially off-screen. The KeePass window should therefore be partially off-screen and partially on-screen.
-This is best demonstrated when the window is partially dragged off-screen to the LEFT or RIGHT sides of the desktop. (The performance issue doesn't seem to happen if the off-screen portion is at the BOTTOM of the desktop.)
Drag the KeePass window so that the previously-offscreen contents become visible again.
-Note that the performance of this window drag is extremely poor ("chunky" or "laggy", running at maybe 3-4 FPS?) as long as any part of the window is still off-screen.
-Resizing the KeePass window tends to be very "laggy" as well, but not as bad as dragging from off-screen.
If you run Windows 10 Task Manager and set View -> Update Speed -> High, and following my steps, CPU usage skyrockets (on my system, reaching over 34% at times). My system is an i5-7600K (that's 4-core/4-thread at 3.8-4.2GHz) with 32GB RAM and no other conflicting/odd applications running.
KeePass is the only application I have that behaves this way. I know it's a .NET Framework application, but most of my other applications are native Win32 and do not exhibit this problem (including major things like Chrome, Firefox, etc.).
I cannot for the life of me determine why performance would completely tank during this operation, but I strongly suspect it has something to do with the fields/columns of database entries.
I do not have the skill set (or development environment) to use a profiler on KeePass to see where CPU time is being spent the most, but I would suggest doing that.
If you'd like me to try older KeePass 2.x versions to see if this problem was introduced in a specific version, let me know. I can try KeePass 1.x as well if asked.
I cannot reproduce the issue on my W10 KP 2.53.1 system.
Having any part of KeePass off screen makes no difference to the speed of moving the KeePass window.
Do you have KeePass set to "always on top"? (This doesn't make any difference on my system.)
Do you have any plug-ins?
Do you have any triggers?
Does it happen with a new database?
cheers, Paul
I can reproduce this problem even on a dedicated Windows 10 VM running under VMware Workstation 17. (The off-screen performance issue I describe is even worse under a VM, but that's because it's a VM, so it acts as a good test subject.) Details:
A new database includes a couple groups and 2 "Sample" entries. This by itself DOES NOT trigger the performance problem (I suspect it's there but just super minimal).
However, if I select the entries and choose Duplicate Entries, then do this several times over -- so that I have, say, 200 entries or so -- then the performance problem becomes easily noticeable (just like on my actual workstation).
My workstation and the VM are both using Windows 10 Pro 22H2 Build 19045.2965.
In contrast: if I load the same test database file into KeePassXC on the same system (physical workstation or VM, doesn't matter), the off-screen performance is perfectly fine. (Yes I know XC uses QT while KeePass 2.x doesn't.)
Let me know what other things I can try. If I need to get Visual Studio (or what Microsoft is calling it now) and try compiling KeePass 2.x from source + trying to analyse this with a profiler, I can do so, but I would much rather author/maintainer be able to diagnose this issue.
I've tested with a 31100 entry database and still no issue.
I see some very small stuttering as I move the window back onto the screen, but nothing like you report.
Get the file here: https://sourceforge.net/p/keepass/discussion/329220/thread/d85d1f7b7d/#a31b
cheers, Paul
Some general testing shows that the number of columns visible (using Customize Columns...) greatly affects how noticeable this problem is. But I asked myself: why would the number of columns matter? (Answer: it doesn't, keep reading.)
Further tests demonstrate that the "choppiness" happens only when the column content is what's being dragged from off-screen. How can I can explain this more clearly, hmm...
The main KeePass window (where column contents are) -- I will call this the "main content area" -- can consist of a few things:
Say User Name, Password and URL columns are visible, and that all the columns when resized take up roughly 50% of the main content area -- the remaining 50% on the right side is white/empty.
What I suspect is that KeePass is doing excess operations (refreshes? DrawText?) conditionally depending on whether some content is deemed visible by the Win32 messaging system, which in this case is column content. It worsens when there's text in a column that's being dragged from off-screen. When I say messaging system, I'm talking about things like WM_PAINT, WM_NCPAINT, etc.. I also suspect .NET hides a lot of this, so there could be some very uncomfortable edge case that's happening.
I should note that the KeePass window/application as a whole DOES NOT flash/flicker (i.e. all rects aren't being redrawn), just that the dragging is extremely choppy.
Thanks for the "31100 entries.kbdx" file! I downloaded it and loaded it. The load time is longer (understandably), but that's fine, but also irrelevant to the problem I'm describing here.
The problem/performance hit using that file when dragging things on-screen is about the same as the new database I had with almost 200 entries. That said:
Have you tried with an older version of KeePass?
Download a previous version zip file (https://sourceforge.net/projects/keepass/files/KeePass%202.x/2.49/)
Extract it to a temporary directory.
Create a "KeePass.config.xml" file to keep it away from your existing config. See this post for details:
https://sourceforge.net/p/keepass/discussion/329221/thread/17d8f645d3/?limit=25#757f
Test using the test database.
cheers, Paul
Good lord, I wrote up a response and Sourceforge timed me out. Sigh...
TL;DR -- Problem starts with 2.x, for the most part. Performance on 1.x is what I would expect, but it greatly worsens with the introduction of the 2.x series. Polite reminder: the issue happens when dragging on-screen a field/column that has content in it. If the field is empty, there is no performance issue (i.e. on-par with 1.x).
If you need me to make a 60fps video demonstrating this problem, I can do so. As stated previously, it can be easily reproduced on even a VM (VMware Workstation 17.x).
If you would like me to try and debug/profile this, I can do so, but I need instructions/documentation on what all I need to install, i.e. Visual Studio (and what version), any dependencies, etc.. I'm not a programmer by trade, but I've done my share during my lifetime (65xxx assembly, x86 assembly, still do C today, Python, etc.). But it absolutely has something to do with fields/columns which have content.
Let me know how you want me to proceed.
Footnote: one of the versions -- either 2.35 or 2.10 -- asked me to install .NET Framework 3.5, which surprisingly worked on Windows 10. I was shocked!
KeePass dragging performance testing
Database: 31100 entries.kdbx (password: test)
DB source: https://sourceforge.net/p/keepass/discussion/329220/thread/d85d1f7b7d/#a31b
All KeePass downloads from https://sourceforge.net/projects/keepass/files/
All tests done using KeePass Portable versions.
Only KeePass settings changed from stock defaults are:
Test Results
Note #1: 31100 entries.kdbx was too new of a DB format to work with 2.10. Used KeePass 2.54 to export the DB to "KeePass KDBX (2.34, Old Format)" but it still would not load ("The file version is unsupported"). Had to use KeePass XML (2.x) and then make a new DB + import 31100 entries.xml.
Note #2: 31100 entries.kdbx cannot be read in 1.x. Used KeePass 2.54 to export the DB to "KeePass KBD (1.x)". "Less slow" means that it's not as slow moving the window off-screen as 2.x series, but it's still chunky. Obviously resizing the window is EXTREMELY slow (expected with 1.x, known issue). For version 1.10 and older, I simply loaded the .kbd previously mentioned.
Note #3: could not open 31100 entries.kbdx or 3110 entries.kbd or the new DB from Note #1 ("File signature invalid!"). I suspect this version had a bug where it showed a file listing for *.* rather than *.kbd despite showing otherwise. Anyway, I did the same process as in Note #2 (made new DB + imported XML). However, version 2.00 does not have "Automatically resize entry list columns", so I just manually resized the columns to take up the full view area.
.NET is responsible for all screen drawing operations and your testing with different versions of KeePass suggests that .NET is the issue.
Can you update .NET on a VM and test?
cheers, Paul
What would you like me to upgrade to?
I'm not even sure how to ensure what's installed right now reliably. Microsoft's own documentation on this is laughable at best. The closest thing I was able to find was this other Microsoft document which returns the following in PowerShell on both said VM as well as my physical workstation:
The only other info I have is that Windows Update downloads occasional Cumulative Update Previews for .NET versions ranging from 3.5 to 4.8.1 for 22H2.
I don't have a plethora of .NET applications, but the other common one I use is BizHawk. I can confirm there is some "chunkiness" when dragging one of their Configuration -> Firmwares windows back on-screen. This window uses fields/columns similarly to KeePass, but not sure if they're identical code-wise or not.
If you know of any other .NET applications that use similar feature sets that I can test, I'd be more than happy to. And yes, if this is a .NET issue I am more than happy to drive it with Microsoft.
You have a recent(ish) .NET so that is probably not the issue.
Have you tried a different video driver?
cheers, Paul
Considering this problem is reproducible on bare-metal (NVIDIA-based GPU) and virtual machines (VMware-based), I would say it's pretty safe to rule out GPU drivers. I do not have AMD GPUs to test with. Not to mention, as prev. stated, the columns/fields seem to be what exacerbate this problem.
Let me know the answers to my prev questions, re: "If you know of any other .NET applications that use similar feature sets" and "If you would like me to try and debug/profile this".
Short of trying it on completely different hardware I don't know what to suggest.
cheers, Paul
No problem. Thanks for all the help Paul! We can close this ticket out.