Powertoys: MSIX: Performance drop on file explorer file selection

Created on 1 Feb 2020  路  17Comments  路  Source: microsoft/PowerToys

After installing PowerToys using the MSIX installer, the file explorer UI lags quite a bit when selecting files. It seems to occur at time and at times it doesn't, but almost always occurs on the first use after installation. Disabling PowerRename alone doesn't help either. This performance hit doesn't occur with the MSI installer for the same set of binaries.

Steps to reproduce

  • Install using MSIX
  • Open any folder with many files and try selecting a large number with mouse, the UI will get stuck quite a bit.

Expected behavior

A gif of selecting files after installation is done using the msi installer. The UI is smooth.
powerrename_msi

Actual behavior

A gif of selecting files after installation is done using the msix installer. The UI isn't smooth.
powerrename_msix

Even if the perf hit cannot be avoided in case of MSIX, the minimum change to the code should be that disabling PowerRename (and ImageResizer once its out) and any other PowerToys which use context menu handlers should reduce the perf hit.

Area-SetuInstall Issue-Bug Product-PowerRename Resolution-Fix-Committed

All 17 comments

@enricogior @crutkas Can you confirm that this isn't an issue that you are already aware of or that it isn't specific to my machine?

I wasn鈥檛 aware of this issue. Lemme look at it

What version of Windows are you on.

Hi @arjunbalgovind
what CPU are you running? I reproduced it on a 2 core laptop, but not on a 4 core desktop.
I want to make sure we have a reliable way to reproduce it in order to validate a possible fix.

@crutkas I'm on 18363.592.
@enricogior I'm using a 6-core desktop.

@arjunbalgovind
strange, same Windows version as yours, I tried on a 6700K that is a 4 core from 2016 and on a recent 4 core low power laptop and couldn't reproduce it. Only on a 2 core laptop from 2014 it clearly happened.

I also have 6700K and the issue isn't difficult to reproduce. Perhaps the perf-drop is IO-bound, not CPU-bound. It's caused by very frequent PowerRenameUWPUI.exe relaunching - every time the file selection set changes.
Currently, WM_QUIT event is sent as soon as any method of IExplorerCommand exits, so introducing "cooling-down" timer before shutting down the process should fix the issue, since for surrogateServer we doesn't get unloaded anyway.

I should mention that on the machines that didn't show the problem I have NVMe SSDs and 32GB of ram.

I also have nvme (which overheats though) and 64gb ram. it might also be the number of running processes etc.

After investigating the issue, we need to select one of these options:

  • keep the PowerRenameUWPUI.exe in memory forever (consumes 2MB of RAM)
  • keep it in memory for X amount of minutes (possible one time lag)
  • switch to COM SurrogateServer (not suggested at this stage, it requires a significant code refactoring, it also lags and may introduces other issues/bugs like the icon not working)

@crutkas how should we proceed?

I think we need to think about a solution that will include image resized and others In The future such as #120. My gut says for 2mb, keep it in memory and for 0.16 we do a generic launcher so we can support more and then only have one item vs 3+ in memory.

Thoughts?

Having one extension registered for all modules is definitely something we should consider.

For ImageResizer, since I am implementing the IExplorerCommand interface now to support the MSIX build I'm using the SurrogateServer, since ImageResizer doesn't have a C++ exe which can be used for the exe server. It only has the C++ dll and the .NET exe. Its still in progress but it should hopefully work.

talking with @arunbalgovind, he mentioned a thing I missed in an earlier comment (https://github.com/microsoft/PowerToys/issues/1197#issuecomment-581805047), why is PowerRename's exe being launched each time on selection versus click? He mentioned his solution doesn't have the perf hit due to not having ImageResizer opening each time for new selection item

@crutkas

why is PowerRename's exe being launched each time on selection versus click

Explorer needs to decide whether or not to show PowerRename context menu action on selection. It must start the PowerRenameUWPUI.exe which is an exe COM server and query the command readiness with IExplorerCommand::GetState method. Finally, when the method returns, the server process exits.

Based on this comment, I'll change this behavior so the server stays in memory forever.

He mentioned his solution doesn't have the perf hit due to not having ImageResizer opening each time for new selection item

Surrogate COM server stays in memory as a dllhost.exe once loaded. I've observed that it also does have a performance hit the very first time while it's being loaded.

I still think we鈥檒l need something like #1217 moving forward for unified code base and minimize system impact

Was this page helpful?
0 / 5 - 0 ratings