-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[WinUI] Creating a complex grid is very slow #21787
Copy link
Copy link
Open
Labels
area-layoutStackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenterStackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenterlayout-gridperf/generalThe issue affects performance (runtime speed, memory usage, startup time, etc.) (sub: perf)The issue affects performance (runtime speed, memory usage, startup time, etc.) (sub: perf)platform/windowst/bugSomething isn't workingSomething isn't working
Milestone
Metadata
Metadata
Assignees
Labels
area-layoutStackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenterStackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenterlayout-gridperf/generalThe issue affects performance (runtime speed, memory usage, startup time, etc.) (sub: perf)The issue affects performance (runtime speed, memory usage, startup time, etc.) (sub: perf)platform/windowst/bugSomething isn't workingSomething isn't working
Type
Fields
Give feedbackNo fields configured for issues without a type.
Description
I have a non-trivial grid which I create by hand (not in XAML but by code) and it can easily take hundreds of milliseconds to show such a grid.
Steps to Reproduce
cd src/Controls/samples/Controls.Sample.Sandboxdotnet publish -f net8.0-windows10.0.19041.0 -c Release -p:PublishReadyToRun=false -p:WindowsPackageType=Nonedotnet trace collect --format speedscope -- .\bin\Release\net8.0-windows10.0.19041.0\win10-x64\publish\Maui.Controls.Sample.Sandbox.exeIt can take 900 ms, and then it speeds up after a several clicks to about 600 ms but it does not drop under that bound.
Speedscope
Maui.Controls.Sample.Sandbox.exe_20240411_223826.speedscope.json
From the data, it's clear that
maui/src/Controls/src/Core/Layout/GridExtensions.cs
Line 60 in 0a562dc
Link to public reproduction project repository
https://github.com/MartyIX/maui/tree/feature/2024-04-11-grid-perf
Version with bug
8.0.20 SR4
Is this a regression from previous behavior?
Not sure, did not test other versions
Last version that worked well
Unknown/Other
Affected platforms
Windows, I was not able test on other platforms
Affected platform versions
Windows 10, Windows 11
Did you find any workaround?
No.
Relevant log output
No response