Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get bounds from RTree in DLBuilder::Build() #50253

Merged
merged 1 commit into from
Feb 1, 2024

Conversation

flar
Copy link
Contributor

@flar flar commented Feb 1, 2024

This optimization was discovered when reviewing the bounds accumulation code in DisplayListBuilder. There is trivially wasted work in the Build() method that can be easily avoided.

When a Builder is preparing an RTree, it accumulates a list of bounds for every rendering op, but doesn't union them up front. If you ask the Builder for the bounds of the accumulated ops, it will have to union all of the rectangles to produce an answer. But, if you ask the Builder to produce an RTree, that process will implicitly combine all of the rectangles as a side effect of creating the tree structure - and that RTree object has a bounds method that can return the result directly.

This change leverages the construction of the RTree to avoid having to union all of the rects twice which can only save time when constructing the majority of DisplayList objects used in a scene.

@flutter-dashboard
Copy link

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

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.

@flar
Copy link
Contributor Author

flar commented Feb 1, 2024

I will be seeking a test exemption on the grounds that this change isn't externally testable since it is just a code efficiency change. We already have code that tests the computation of bounds for a DisplayList so this change should be covered by existing tests.

@flar
Copy link
Contributor Author

flar commented Feb 1, 2024

Note that the added keyword in the dl_op_records.h file was unrelated to the other changes, but clang-tidy requested it.

@flar
Copy link
Contributor Author

flar commented Feb 1, 2024

No ground-breaking benchmark results to show. I did a quick survey of framework benchmarks that I suspect would see an improvement, but the gains were in the noise. This improvement may not show through the noise in the simple apps we use for benchmarking.

@Hixie
Copy link
Contributor

Hixie commented Feb 1, 2024

test-exempt: performance improvement

@flar flar added the autosubmit Merge PR when tree becomes green via auto submit App label Feb 1, 2024
@auto-submit auto-submit bot merged commit 78d7128 into flutter:main Feb 1, 2024
28 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Feb 1, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Feb 2, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Feb 2, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Feb 2, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Feb 2, 2024
…142783)

flutter/engine@dd4c79a...b35153d

2024-02-02 [email protected] Manual roll Dart SDK from 82936dcdaf4f to 5a5d4c262200 (2 revisions) (flutter/engine#50264)
2024-02-01 [email protected] Remove number of arguments from defining Dart FFI (flutter/engine#50153)
2024-02-01 [email protected] Refactor the linux_android targets to make use of recent changes to android virtual device params (flutter/engine#50099)
2024-02-01 [email protected] Re-add tests deleted on accident (flutter/engine#50223)
2024-02-01 [email protected] [Impeller] updated todos from opengles golden work (flutter/engine#50218)
2024-02-01 [email protected] Get bounds from RTree in DLBuilder::Build() (flutter/engine#50253)
2024-02-01 [email protected] [Impeller] Remove unused define. (flutter/engine#50250)
2024-02-01 [email protected] Add the focus state related methods to the platform dispatcher (flutter/engine#49841)
2024-02-01 [email protected] Fix the output paths of the Web esbuild GN template (flutter/engine#50188)
2024-02-01 [email protected] [Impeller] Delete unnecessary special casing for Vulkan in framebuffer fetch. (flutter/engine#50251)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants