Improve efficiency of copying the animation ObserverList in notifyListeners#102536
Conversation
|
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 Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on 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. |
goderbauer
left a comment
There was a problem hiding this comment.
Why is this more efficient? Is there a benchmark?
There was a problem hiding this comment.
should this specify "growable: false"?
There was a problem hiding this comment.
Changed this to growable: false
I didn't notice a performance difference, but looking at the Dart SDK sources it looks like using toList(growable: false) will save one allocation.
a86fe81 to
bd40652
Compare
|
I noticed this while profiling some animations. This improves performance by avoiding the construction and invocation of an The Dart team now recommends avoiding the |
goderbauer
left a comment
There was a problem hiding this comment.
LGTM
Thanks for the extra context!
I wonder if the recommendations given there could be encoded in lints to remind developers to do the right thing. Filed dart-lang/sdk#58716 for that. |
No description provided.