Skip to content

Fix Slow Event Log Scrolling for large # of events - #4175

Merged
CoderDake merged 4 commits into
flutter:masterfrom
CoderDake:event-logging-lag
Jun 8, 2022
Merged

Fix Slow Event Log Scrolling for large # of events#4175
CoderDake merged 4 commits into
flutter:masterfrom
CoderDake:event-logging-lag

Conversation

@CoderDake

Copy link
Copy Markdown
Contributor

Details

Fixes #3238

It is a known issue that ListItem.builder lists can have performance issues when scrolling large lists.
The reasoning for this is that the height of each item needs to be calculated when scrolling along a list. So the list being scrolled can't just skip to the new location.

If the height of each row is the same, this performance hit can be avoided by telling the ListView the height of each row ahead of time.
This is done by setting the itemExtent.

In our case the height of each row height is the same and should be defaultRowHeight

This also benefits the scrolling speed on the profiler page

Demos

Original Behaviour

d6idd65lgkw540ta28177tc2.mp4

Fixed Behaviour

tlxo4iyurw5c28sdchmg59av.mp4

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read the Flutter Style Guide recently, and have followed its advice.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

@CoderDake
CoderDake marked this pull request as ready for review June 8, 2022 15:36
Comment on lines +821 to +825
_TableState<T> createState() => _TableState<T>(rowItemExtent: rowItemExtent);
}

class _TableState<T> extends State<_Table<T>> with AutoDisposeMixin {
_TableState({this.rowItemExtent});

@kenzieschmoll kenzieschmoll Jun 8, 2022

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.

never pass parameters into state objects. You can access the widget class member from the state object via widget.rowItemExtent

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.

this is a good life lesson thank you :)

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.

I'm surprised the no-logic in createState lint didn't warn about this.

@CoderDake
CoderDake merged commit 5a1bbc3 into flutter:master Jun 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Poor performance on "Logging" tab when lots of events are emmited

3 participants