Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@yjbanov
Copy link
Contributor

@yjbanov yjbanov commented May 28, 2020

Change many-to-many child node update to move as few elements as possible. This captures many more cases than the previous naive implementation did. In particular it improves backwards scrolling by 15%-25% (see e.g. flutter/flutter#55922).

Below are A/B benchmark results from our infinite scrolling benchmark (I'm adding the backwards scrolling variant in flutter/flutter#58140).

I will consider that this fixes flutter/flutter#55922, as backwards scrolling was the single biggest issue I've seen in that case. We can open more specific issues for the remaining work.

Score	Average A (noise)	Average B (noise)	Speed-up
bench_card_infinite_scroll.html.drawFrameDuration.average	907.66 (5.34%)	815.24 (11.33%)	1.11x	
bench_card_infinite_scroll.html.drawFrameDuration.outlierRatio	2.80 (6.91%)	2.60 (3.33%)	1.08x	
bench_card_infinite_scroll.html.totalUiFrame.average	2191.67 (6.03%)	2064.50 (10.16%)	1.06x	
bench_card_infinite_scroll_backward.html.drawFrameDuration.average	880.83 (5.51%)	730.35 (10.17%)	1.21x	
bench_card_infinite_scroll_backward.html.drawFrameDuration.outlierRatio	3.01 (2.44%)	3.51 (4.57%)	0.86x	
bench_card_infinite_scroll_backward.html.totalUiFrame.average	2493.50 (5.28%)	2137.67 (6.63%)	1.17x	

@yjbanov yjbanov marked this pull request as ready for review June 1, 2020 02:18
@auto-assign auto-assign bot requested a review from iskakaushik June 1, 2020 02:18
@yjbanov yjbanov requested a review from ferhatb June 1, 2020 02:20
@yjbanov yjbanov force-pushed the many-to-many branch 2 times, most recently from f6e3eae to 41b568c Compare June 1, 2020 19:17
for (int i = 0; i < newUnfilteredChildCount; i++) {
final PersistedSurface child = _children[i];
if (child.isCreated) {
if (child.isCreated && !(child is PersistedContainerSurface && child.oldLayer != null)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

add comment for oldLayer check pls.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. I also removed the is check by moving the oldLayer field to PersistedSurface (it's just that leaf layers always keep it as null).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Slow scrolling when lazy loading elements

3 participants