This repository has been archived by the owner on May 1, 2024. It is now read-only.
[Bug] Adding children to iOS VisualElementPackager has O(N^2) performance and thrashes the native layer #8129
Labels
e/2 🕑
2
hacktoberfest 🍻
help wanted
We welcome community contributions to any issue, but these might be a good place to start!
in-progress
This issue has an associated pull request that may resolve it!
inactive
Issue is older than 6 months and needs to be retested
p/iOS 🍎
t/bug 🐛
up-for-grabs
We welcome community contributions to any issue, but these might be a good place to start!
Milestone
Description
Every time a single child is added
Xamarin.Forms/Xamarin.Forms.Platform.iOS/VisualElementPackager.cs
Line 48 in e9eb9fe
EnsureChildrenOrder is called
Xamarin.Forms/Xamarin.Forms.Platform.iOS/VisualElementPackager.cs
Line 108 in e9eb9fe
Which then loops through all the logical children again
Xamarin.Forms/Xamarin.Forms.Platform.iOS/VisualElementPackager.cs
Line 132 in e9eb9fe
to ensure the Z Index is correctly set.
The code should add all the children first and then process the child order (2N) or just process the child order as things are added for the first time (N)
Steps to Reproduce
Modify this test
Xamarin.Forms/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/RefreshViewTests.cs
Line 34 in 9eb8575
So that it adds some large number of children (2000)
If you run the test on Android then Android renderers fine but if you try to run it on iOS the UI just locks while all the children are getting added
Expected Behavior
A stacklayout with 2000 items shouldn't completely lock iOS. I realize adding 2000 items is a bit of an extreme edge case but the fact that Android renderers it fine and iOS completely locks up is indicative of an exponentially increasing performance issue
Actual Behavior
A stacklayout with 2000 items completely locks iOS but not Android
Basic Information
The text was updated successfully, but these errors were encountered: