Skip to content

Skip painting hidden children of a sliver list - #18465

Merged
liyuqian merged 4 commits into
flutter:masterfrom
liyuqian:skippaint
Jun 15, 2018
Merged

liyuqian merged 4 commits into
flutter:masterfrom
liyuqian:skippaint

Conversation

@liyuqian

Copy link
Copy Markdown
Contributor

We have many hidden children because of iOS accessibility (see also #18410).

For example, in the tile screen of complex_layout app, there could be up to 20 children being painted without this PR. With this PR, only 12 get painted.

Unfortunately, this PR does not move the needle of complex_layout_scroll_perf test. So flutter-team-archive/engine#5497 is still needed to prune out more hidden widgets that maybe only the C++ engine side could determine.

On the other hand, without flutter-team-archive/engine#5497, this PR alone could improve the performance of FL-53 by 40% (because this PR alone could save a lot of render target switches).

@liyuqian

Copy link
Copy Markdown
Contributor Author

CC @tvolkert and @chinmaygarde on the effect of this PR on FL-53.

@Hixie

Hixie commented Jun 13, 2018

Copy link
Copy Markdown
Contributor

This will need tests.

cc @goderbauer and @jonahwilliams for review

@liyuqian

Copy link
Copy Markdown
Contributor Author

Unit test added.

@liyuqian

Copy link
Copy Markdown
Contributor Author

Rebaseline those tree dump strings in the unit test is so painful... What's the best way to do that as I can foresee that I'm going to change it frequently? @Hixie @tvolkert @chinmaygarde

@goderbauer

goderbauer commented Jun 14, 2018 •

Copy link
Copy Markdown
Member

In addition to SliverLists, this will also affect the SliverGrid. Does this work correctly there as well?

@chinmaygarde

Copy link
Copy Markdown
Contributor

Rebaseline those tree dump strings in the unit test is so painful... What's the best way to do that as I can foresee that I'm going to change it frequently?

Sorry, I have no guidance to offer there. We should document the current process on the wiki though.

expect(list, hasAGoodToStringDeep);
final String dump = list.toStringDeep(minLevel: DiagnosticLevel.info);
final int numChildrenPainted = 'layer: OffsetLayer'.allMatches(dump).length;
expect(numChildrenPainted, 2); // only the middle two should be painted

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this test might be a good candidate for the mock_canvas API (search for tests with expectations that mention paints)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

This comment was marked as off-topic.

@liyuqian

Copy link
Copy Markdown
Contributor Author

@goderbauer The SliverGrid can only scroll along the main axis, and this PR would prune those that are outside of the main axis. But this PR won't prune widgets that are outside of the cross axis. I guess that there won't be many hidden widgets along the cross axis because you can never scroll to reveal them. Hence we probably don't need to prune them.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: no {} around count.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe _evaluatePredicates should just return false on a miss-match and you add the failure reason to the StringBuffer description.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@goderbauer goderbauer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jonahwilliams

Copy link
Copy Markdown
Contributor

RSLGTM

@liyuqian
liyuqian merged commit 3806537 into flutter:master Jun 15, 2018
srawlins added a commit to srawlins/flutter that referenced this pull request Jun 15, 2018
* master:
  Remove race conditions involving finding available ports (flutter#18488)
  Skip painting hidden children of a sliver list (flutter#18465)
  Fixed some typos (flutter#18516)
  update Tristate checkbox semantics to consider indeterminate as "unchecked" (flutter#18297)
  Add flutter tool support for creating app-specific VM snapshots. (flutter#18417)
  mention Text.rich on RichText (flutter#18434)
  invert children for real (flutter#18489)
  Fix clipping for SliverLists (flutter#18410)
  Keep TextFields visible when keyboard comes up (flutter#18291)
  Update all packages (flutter#18506)
  Prepare for upgrading video player in Gallery to newest version (flutter#18501)
  Update Android dependencies (flutter#18499)
  Enable running with prebuilt test-only apk (flutter#18453)
  Revert "Update all packages (flutter#18471)" (flutter#18492)
  Add some more dart doc to RepaintBoundary (flutter#17183)
  Update all packages (flutter#18471)
  Clean up output of "flutter run --release" (flutter#18380)
  Ensure errors launching emulators are exposed to the daemon (flutter#18446)
  Check video widget is mounted on call to setState (flutter#18467)
  Fixed concurrent list modification in vmservice.dart
jonahwilliams pushed a commit that referenced this pull request Jun 16, 2018
@liyuqian
liyuqian deleted the skippaint branch April 29, 2019 17:31
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Aug 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants