Skip to content
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

Closed
PureWeen opened this issue Oct 21, 2019 · 3 comments · Fixed by #8231
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

Comments

@PureWeen
Copy link
Contributor

Description

Every time a single child is added

EnsureChildrenOrder is called

Which then loops through all the logical children again

for (var z = 0; z < ElementController.LogicalChildren.Count; z++)

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

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

  • Version with issue: master
  • Last known good version: not sure
  • IDE:
  • Platform Target Frameworks:
    • iOS: All versions
@PureWeen PureWeen added t/bug 🐛 p/iOS 🍎 s/unverified New report that has yet to be verified labels Oct 21, 2019
@PureWeen PureWeen added this to the 4.4.0 milestone Oct 21, 2019
@PureWeen PureWeen added hacktoberfest 🍻 up-for-grabs We welcome community contributions to any issue, but these might be a good place to start! labels Oct 21, 2019
@adrianknight89
Copy link
Contributor

Lately, CollectionView wrapped by RefreshView is freezing on iOS (with only a few items) when I scroll to the bottom though it may be an entirely different issue. This is an interesting find. On first look, I definitely do not like Forms calling BringSubviewToFront for every child.

@samhouts samhouts added e/2 🕑 2 and removed s/unverified New report that has yet to be verified labels Oct 23, 2019
@samhouts samhouts removed this from the 4.4.0 milestone Oct 23, 2019
@samhouts samhouts added the help wanted We welcome community contributions to any issue, but these might be a good place to start! label Oct 23, 2019
@memsranga
Copy link
Contributor

Moved the ordering just after adding it the first time.
When a new Child is added we anyway are calling EnsureChildrenOrder, so shouldn't effect runtime changes.

@samhouts samhouts added the in-progress This issue has an associated pull request that may resolve it! label Nov 2, 2019
@samhouts samhouts added the inactive Issue is older than 6 months and needs to be retested label May 15, 2020
@samhouts samhouts added this to the 5.0.0 milestone Aug 13, 2020
@rmarinho rmarinho modified the milestones: 5.0.0, .NET MAUI Oct 30, 2020
@rmarinho rmarinho removed this from the .NET MAUI milestone Oct 30, 2020
@PureWeen PureWeen added this to the 5.0.1 milestone Nov 2, 2020
@AlleSchonWeg
Copy link
Contributor

AlleSchonWeg commented May 19, 2021

Hi,

is there any workaround available or will the linked PR find its way in the next SR?
c'mon

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
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!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants