Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-27434

Android: Re-layout of deeply nested views can cause performance issues as of 7.5.0

    Details

    • Story Points:
      5
    • Sprint:
      2019 Sprint 20, 2019 Sprint 21

      Description

      Summary:
      If you have very deeply nested views (say 15 or more), then anything that causes them to be re-laid out can cause noticeable performance issues as of Titanium 7.5.0.

      Steps to reproduce:

      1. Build and run the below code on Android.
      2. Tap and hold on the text within the TextField.
      3. Notice that the app hangs for a couple of seconds.
      4. Rotate the device to landscape.
      5. Notice that the app hangs for a couple of seconds.

      var window = Ti.UI.createWindow();
      var rootView = Ti.UI.createView({ width: Ti.UI.FILL, height: Ti.UI.FILL });
      var topView = rootView;
      for (var index = 0; index < 20; index++) {
      	var nextView = Ti.UI.createView({ width: Ti.UI.FILL, height: Ti.UI.FILL });
      	topView.add(nextView);
      	topView = nextView;
      }
      var textField = Ti.UI.createTextField({
      	value: "Hello World",
      	width: "80%",
      });
      topView.add(textField);
      window.add(rootView);
      window.open();
      

      Cause:
      This regression was introduced in 7.5.0 when we added the "extendSafeArea" and "safeAreaPadding" feature. The performance issue is caused by our Java TiCompositeLayout.onApplyWindowInsets() method when you have deeply nested views (say 15 or more layers). The dispatched window inset handling appears to get exponentially worse the more views you have nested. Especially since each child view that applies those insets triggers a request-layout.

      Work-around:
      Only known work-around is to not nest your views so deeply. Try not to nest more than 10 layers deep.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jquick Joshua Quick
                Reporter:
                jquick Joshua Quick
                Reviewer:
                Christopher Williams
                Tester:
                Lokesh Choudhary
              • Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                    Git Integration