engine icon indicating copy to clipboard operation
engine copied to clipboard

[display_list] grow display list backing store by power of two.

Open jonahwilliams opened this issue 1 year ago • 4 comments

Fixes https://github.com/flutter/flutter/issues/157108

Right now the DL is always growing by a minimum 4096 bytes at a time. On applications with large display lists, this can lead to hundreds of reallocations as the display list is build, as long as each draw op is small. For example, the framework benchmark long picture scrolling draws many lines, each of which is a pretty small op.

Update the code so that we grow by doubling, with a minimum increment of ~16K

jonahwilliams avatar Oct 21 '24 23:10 jonahwilliams

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!).

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group.

flutter-dashboard[bot] avatar Oct 21 '24 23:10 flutter-dashboard[bot]

I believe you changed drawVertices to not copy into the display list. drawPoints/drawAtlas still embed their data right?

jonahwilliams avatar Oct 22 '24 21:10 jonahwilliams

I believe you changed drawVertices to not copy into the display list. drawPoints/drawAtlas still embed their data right?

Anything that uses CopyV in dl_builder.cc could potentially have a very large size. I didn't double check, that list was off the top of my head...

flar avatar Oct 22 '24 22:10 flar

Confirmed that drawPoints does it, I'll use this to test

jonahwilliams avatar Oct 22 '24 22:10 jonahwilliams

The benchmark to watch is https://flutter-flutter-perf.skia.org/e/?begin=1727976394&end=1729696415&queries=test%3Dvery_long_picture_scrolling_perf_ios__e2e_summary&requestType=0&selected=commit%3D42943%26name%3D%252Carch%253Dintel%252Cbranch%253Dmaster%252Cconfig%253Ddefault%252Cdevice_type%253DiPhone_11%252Cdevice_version%253Dnone%252Chost_type%253Dmac%252Csub_result%253D99th_percentile_frame_rasterizer_time_millis%252Ctest%253Dvery_long_picture_scrolling_perf_ios__e2e_summary%252C

jonahwilliams avatar Oct 23 '24 15:10 jonahwilliams

reason for revert: unexpected framework ui thread regression, no performance improvement

jonahwilliams avatar Oct 24 '24 01:10 jonahwilliams