Skip to content

Make large jumpTo recommend deferred loading#64271

Merged
fluttergithubbot merged 2 commits intoflutter:masterfrom
dnfield:jump_activity
Aug 21, 2020
Merged

Make large jumpTo recommend deferred loading#64271
fluttergithubbot merged 2 commits intoflutter:masterfrom
dnfield:jump_activity

Conversation

@dnfield
Copy link
Contributor

@dnfield dnfield commented Aug 20, 2020

Description

Before this patch, a fling of a scrollable will end up recommending deferred loading, but not a similarly large (or larger) jumpTo.

This adds an _impliedVelocity field to ScrollPosition that tracks how many pixels were forced in a single frame, and adds that to the activity's velocity when asking the ScrollPhysics whether we should defer.

Related Issues

Fixes #64124

Tests

I added the following tests:

Test that this works as expected when using jumpTo with large values.

Checklist

Before you create this PR, confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I signed the CLA.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I updated/added relevant documentation (doc comments with ///).
  • All existing and new tests are passing.
  • The analyzer (flutter analyze --flutter-repo) does not report any problems on my PR.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Did any tests fail when you ran them? Please read Handling breaking changes.

  • No, no existing tests failed, so this is not a breaking change.

@dnfield dnfield requested a review from goderbauer August 20, 2020 19:24
@flutter-dashboard flutter-dashboard bot added the framework flutter/packages/flutter repository. See also f: labels. label Aug 20, 2020
@dnfield dnfield added a: images Loading, displaying, rendering images f: scrolling Viewports, list views, slivers, etc. and removed cla: yes labels Aug 20, 2020
Copy link
Member

@goderbauer goderbauer left a comment

Choose a reason for hiding this comment

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

LGTM

@fluttergithubbot fluttergithubbot merged commit eef4220 into flutter:master Aug 21, 2020
@liyuqian liyuqian added perf: memory Performance issues related to memory c: performance Relates to speed or footprint issues (see "perf:" labels) labels Aug 21, 2020
@liyuqian
Copy link
Contributor

It would be nice if we could have a memory test for this. On iOS, we now have a timeline of memory usages that can be used to capture the peak memory usage (flutter/engine#18516).

smadey pushed a commit to smadey/flutter that referenced this pull request Aug 27, 2020
mingwandroid pushed a commit to mingwandroid/flutter that referenced this pull request Sep 6, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 21, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

a: images Loading, displaying, rendering images c: performance Relates to speed or footprint issues (see "perf:" labels) f: scrolling Viewports, list views, slivers, etc. framework flutter/packages/flutter repository. See also f: labels. perf: memory Performance issues related to memory

Projects

None yet

Development

Successfully merging this pull request may close these issues.

scrollController.jumpTo() at top causes a surge in memory

5 participants