Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Added identical(a,b) short circuit to rendering library lerp methods #121566

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

Merged
merged 1 commit into from
Feb 28, 2023

Conversation

HansMuller
Copy link
Contributor

Handle a common case in Foo.lerp(a, b, t): if a and b are identical, then just return a. This avoids needlessly constructing a new Foo and recursively lerping all of its properties. If a and b refer to the same const object, then we also preserve their singleton identity.

This PR is similar to #120829

All of the lerp methods in the began library began with:

if (a == null && b == null) {
  return null;
}

This PR safely generalizes the short-circuit to:

if (identical(a, b)) {
  return a;
}

@flutter-dashboard flutter-dashboard bot added the framework flutter/packages/flutter repository. See also f: labels. label Feb 27, 2023
Copy link
Member

@goderbauer goderbauer left a comment

Choose a reason for hiding this comment

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

LGTM!

@HansMuller HansMuller added the autosubmit Merge PR when tree becomes green via auto submit App label Feb 28, 2023
@auto-submit auto-submit bot merged commit 1bfba75 into flutter:master Feb 28, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 28, 2023
@HansMuller HansMuller deleted the lerp_identical_rendering branch February 28, 2023 16:16
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 10, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 10, 2023
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 framework flutter/packages/flutter repository. See also f: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants