Shell extension performance issue
Extension reads all HDROP format data, although if the number of items exceeds 3, menu item is disabled, so there is no need to read HDROP if it contains more than 3 items. With a large number of items, HDROP reading can take a long time, which will slow down context menu opening.
WinMerge 2.16.50.2 x64
Thank you for reporting this issue. Could you please tell us approximately how many files were selected when you noticed the slowdown in the context menu?
Context menu opening results:
| w/out ShellExtensionX64.dll | with ShellExtensionX64.dll | |
|---|---|---|
| 10k items | 1.6 sec | 4.3 sec |
| 50k items | 8.5 sec | 82.8 sec |
I created 50,000 files in the same folder and opened the context menu after selecting them, but I didn’t notice any significant slowdown. Are you perhaps using an HDD instead of an SSD?
For now, I’ve made a fix in commit a076253.
I assume that you used Explorer for testing. Explorer calls IShellFolder::GetUIObjectOf with one item to get IContextMenu interface, even if several items are selected. You need to use file manager that will query IContextMenu for all selected items. I used CDefFolderMenu_Create2 to populate context menu for several items.