-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PowerRename] Handle many items w/o crashing and OOM #26761
Conversation
0c6864f
to
68cc489
Compare
954ef5a
to
a08c29c
Compare
Ready for review. Supports up to 100K entries on my machine w/o issues. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still see issues on "Only show items that will be renamed" view on scrolling. All renamable items end up in the same depth, i.e. folders are lost
src/modules/powerrename/PowerRenameUILib/ExplorerItemsSource.idl
Outdated
Show resolved
Hide resolved
src/modules/powerrename/PowerRenameUILib/ExplorerItemViewModel.cpp
Outdated
Show resolved
Hide resolved
Ready for review. After internal discussion, we've decided to move forward with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested on ARM, it works stable and not crashing on a significant amount of files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After starting from a clean start (Delete "%localappdata%\Microsoft\PowerToys"), it shows no files when selecting a 10000 file folder I was testing with:
Can we default to showing some files as the default, like before? This will be a bad default experience as users won't understand what's going on.
@jaimecbernardo nice catch, fixed! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, it looks good. There are few things discussed privately that could be investigated to improve performance. Ok to have those as separate PRs.
For this one, let's just fix showing directory structure of Show only files that will be renamed
view.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very nice! :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested and works as expected. Thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested, works nicely!
Summary of the Pull Request
PowerRename.100K.ListView.mp4
ListView
CheckBox
PR Checklist
Detailed Description of the Pull Request / Additional comments
So, simply using WinUI's
CheckBox
causes the app to crash, as was noted previously. Using aDataTemplate
with aCheckBox
instead of wrapping it in aUserControl
makes the behavior much better, but it's still possible to crash it.Another issue is that the scrolling starts to slow down and end up unusable. Sampling the call stack shows it happens somewhere in the DirectComposition layer:
Inspecting Live Visual Tree has shown that UI virtualization is also active: the number of
ListViewItem
s doesn't grow beyond a certain number. Explicitly settingVirtualizingStackPanel
as aListView.ItemsPanel
didn't make a difference.<animatedVisuals:AnimatedAcceptVisualSource />
ofAnimatedIcon
, i.e. the check mark icon.Looking at the docs, we can find the line responsible for not using animation, but it doesn't make a difference when turning off the animations (Accessibility -> Visual Effects -> Animation effects). I haven't found a way to force Fallback animation, so I've removed the AnimatedIcon by overriding CheckBox's Style and filed an issue in WinUI repo.
Now, trying to add many items using
DEBUG_BENCHMARK_100K_ENTRIES
resulted in an OOM on my system, because each element of vec<ExplorerItem
> is aUserControl
, thusExplorerItemsSource
andExplorerItemViewModel
were implemented to support data virtualization and is essentially a proxy toIPowerRenameManager
's items.For some reason,
x:Bind
doesn't work in the context ofDataTemplate
when bindingExplorerItem
's properties toExplorerItemViewModel
's properties with the same name, so I've added VM suffices to the property names accordingly.Using parallel
std::sort
increased startup performance from 80seconds to 30seconds.OnAdded and OnUpdated events are no longer needed anymore, as well as ExplorerItemsMap.
Validation Steps Performed