Skip to content

Conversation

@flar
Copy link
Contributor

@flar flar commented Jul 17, 2019

Primarily these methods no longer allocate any objects other than their
return values.

Additionally, the math in the methods is reduced compared to the general
case math based on known input conditions.

Results from a Moto E2 phone...
Before:

I/flutter (12908): MatrixUtils.transformRectPerspective: 3167.3 ns per iteration
I/flutter (12908): MatrixUtils.transformRectAffine: 3098.9 ns per iteration
I/flutter (12908): MatrixUtils.TransformPointPerspective: 640.2 ns per iteration
I/flutter (12908): MatrixUtils.TransformPointAffine: 633.0 ns per iteration

After:

I/flutter ( 8339): MatrixUtils.transformRectPerspective: 1026.5 ns per iteration
I/flutter ( 8339): MatrixUtils.transformRectAffine: 647.7 ns per iteration
I/flutter ( 8339): MatrixUtils.transformPointPerspective: 511.9 ns per iteration
I/flutter ( 8339): MatrixUtils.transformPointAffine: 477.4 ns per iteration

Results from a Samsung Note 9...
Before

I/flutter ( 3761): MatrixUtils.transformRectPerspective: 432.0 ns per iteration
I/flutter ( 3761): MatrixUtils.transformRectAffine: 430.4 ns per iteration
I/flutter ( 3761): MatrixUtils.transformPointPerspective: 64.6 ns per iteration
I/flutter ( 3761): MatrixUtils.transformPointAffine: 63.5 ns per iteration

After:

I/flutter ( 5862): MatrixUtils.transformRectPerspective: 80.4 ns per iteration
I/flutter ( 5862): MatrixUtils.transformRectAffine: 55.0 ns per iteration
I/flutter ( 5862): MatrixUtils.transformPointPerspective: 39.4 ns per iteration
I/flutter ( 5862): MatrixUtils.transformPointAffine: 39.4 ns per iteration

Primarily these methods no longer allocate any objects other than their
return values.

Additionally, the math in the methods is reduced compared to the general
case math based on known input conditions.
@flar flar requested review from goderbauer and yjbanov July 17, 2019 21:15
@fluttergithubbot fluttergithubbot added the framework flutter/packages/flutter repository. See also f: labels. label Jul 17, 2019
@flar
Copy link
Contributor Author

flar commented Jul 17, 2019

Newest update resolves:

  • Expanded left/right/top/bottom += whxy logic to multi-line to fix analyzer issues
  • Fixed variable names in test

I did not add any code to compare test results to vector_math

Copy link
Contributor

@dnfield dnfield left a comment

Choose a reason for hiding this comment

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

LGTM - I would defer to yjbanov though

Copy link
Contributor

@liyuqian liyuqian left a comment

Choose a reason for hiding this comment

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

LGTM!

@flar flar merged commit 9946f7c into flutter:master Jul 24, 2019
dnfield added a commit to dnfield/flutter that referenced this pull request Jul 26, 2019
dnfield added a commit that referenced this pull request Jul 27, 2019
* Revert "Optimize the transformRect and transformPoint methods in matrix_utils. (#36396)"

This reverts commit 9946f7c.

* add test
johnsonmh pushed a commit to johnsonmh/flutter that referenced this pull request Jul 30, 2019
flutter#36396)

Primarily these methods no longer allocate any objects other than their
return values.

Additionally, the math in the methods is reduced compared to the general
case math based on known input conditions.
johnsonmh pushed a commit to johnsonmh/flutter that referenced this pull request Jul 30, 2019
* Revert "Optimize the transformRect and transformPoint methods in matrix_utils. (flutter#36396)"

This reverts commit 9946f7c.

* add test
flar added a commit to flar/flutter that referenced this pull request Jul 31, 2019
flutter#36396)

Primarily these methods no longer allocate any objects other than their
return values.

Additionally, the math in the methods is reduced compared to the general
case math based on known input conditions.

Modified to no longer generate infinite values in some finite cases.
flar added a commit that referenced this pull request Jul 31, 2019
…ix_utils. (#36396) (#37275)

Primarily these methods no longer allocate any objects other than their
return values.

Additionally, the math in the methods is reduced compared to the general
case math based on known input conditions.

Modified to no longer generate infinite values in some finite cases.
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants