-
Notifications
You must be signed in to change notification settings - Fork 6k
[Impeller] dont increment shared_ptr when tracked object is already tracked. #56153
[Impeller] dont increment shared_ptr when tracked object is already tracked. #56153
Conversation
|
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. |
| return; | ||
| } | ||
| tracked_objects_.emplace_back(std::move(object)); | ||
| tracked_objects_.emplace_back(object); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is incrementing now. The thesis is that this increment matches the one we are replacing when we grab a const ref and in the case where we leave early we avoid the increment altogether? SGTM. I wish we had settings on that required an explicit copy here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, though I found from tracing that we still have multiple share_ptr decrements per draw because the buffer_view emplacement also does a move still. I will send a separate patch for that
…157736) flutter/engine@bf5bfee...23b2c6d 2024-10-28 [email protected] [Impeller] dont increment shared_ptr when tracked object is already tracked. (flutter/engine#56153) 2024-10-28 [email protected] Roll Dart SDK from a75848f92210 to 69b50768d733 (2 revisions) (flutter/engine#56168) 2024-10-28 [email protected] Roll Skia from 263c3e2ecd30 to f08fbc465888 (1 revision) (flutter/engine#56170) 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] 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
…racked. (flutter/engine#56153) By passing the shared_ptrs to TrackedObjectsVK by value, we will always require at least a decrement of the shared_ptr count, and possibly an increment too. Since for most cases the tracked object has already been tracked, passing by const ref results in no increment or decrement. Ignoring the time value, since this is a flamegraph, we can see almost all time spent tracking is spent on shared_ptr decrement: 
By passing the shared_ptrs to TrackedObjectsVK by value, we will always require at least a decrement of the shared_ptr count, and possibly an increment too.
Since for most cases the tracked object has already been tracked, passing by const ref results in no increment or decrement.
Ignoring the time value, since this is a flamegraph, we can see almost all time spent tracking is spent on shared_ptr decrement: