ImageGlass
ImageGlass copied to clipboard
ReloadImageList is sub-optimal
Windows 10 -> viewing images in a folder across the network. "Include child folders" is ON. The folder in question had 22,184 files and 317 folders.
Behavior:
- Ran IG.
- Opened an image at the top of the tree.
- IG showed images and could be used in 1 second or so.
- Goto settings, change sort order. [Sufficient to switch sort-by-name from Ascending to Descending, or visa-versa]. Save and exit.
At this point, ImageGlass takes 12+ seconds to come back to life.
Running Performance Profiler, the CPU hotspot identified is GetDistinctDirsFromPaths
. Specifically, the call to File.Exists()
.
Debugging:
A. On the initial call, GetDistinctDirsFromPaths
is given a single path, the original single file opened.
B. On the second call (as invoked from ReloadImageList
), GetDistinctDirsFromPaths
is given a pathlist containing every file in the image list!
File.Exists()
is a relatively expensive call, especially across the network.
A simple resort of the existing list should not require a full verification of every single file and path.