Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@flar
Copy link
Contributor

@flar flar commented Feb 13, 2024

Adds benchmarks (and backend support methods) for tracking the performance of the stroking code in the entity geometry package.

@flar
Copy link
Contributor Author

flar commented Feb 13, 2024

Some notes:

  • The same backend methods could be used to write some unit tests with another friend statement
  • I only tested 2 axes of the 9 possible combinations of cap/join using the simplest cap with all joins and the simplest join with all caps
  • RRect doesn't invoke any caps or joins so it is only run with token butt/bevel settings
  • I'm not sure why the Round_Bevel and Square_Bevel results are nearly the same...?

@flar
Copy link
Contributor Author

flar commented Feb 13, 2024

Sample output showing all of the combinations that are now run:

-------------------------------------------------------------------------------------------------------------
Benchmark                                                   Time             CPU   Iterations UserCounters...
-------------------------------------------------------------------------------------------------------------
BM_Polyline/cubic_polyline                               9478 ns         9471 ns        75427 SinglePointCount=155 TotalPointCount=11.6912M
BM_Polyline/cubic_polyline_tess                         34617 ns        34510 ns        20027 SinglePointCount=471 TotalPointCount=9.43272M
BM_StrokePolyline/stroke_Cubic_Butt_Bevel                4676 ns         4662 ns       149240 SinglePointCount=906 TotalPointCount=135.211M
BM_StrokePolyline/stroke_Cubic_Butt_Miter                5450 ns         5439 ns       131071 SinglePointCount=801 TotalPointCount=104.988M
BM_StrokePolyline/stroke_Cubic_Butt_Round               16685 ns        16653 ns        42292 SinglePointCount=946 TotalPointCount=40.0082M
BM_StrokePolyline/stroke_Cubic_Square_Bevel              4768 ns         4754 ns       147723 SinglePointCount=906 TotalPointCount=133.837M
BM_StrokePolyline/stroke_Cubic_Round_Bevel               4826 ns         4804 ns       146950 SinglePointCount=906 TotalPointCount=133.137M
BM_StrokePolyline/stroke_Cubic_Butt_Bevel_uv             9342 ns         9316 ns        75521 SinglePointCount=906 TotalPointCount=68.422M
BM_StrokePolyline/stroke_Cubic_Butt_Miter_uv             9104 ns         9064 ns        77211 SinglePointCount=801 TotalPointCount=61.846M
BM_StrokePolyline/stroke_Cubic_Butt_Round_uv            18785 ns        18691 ns        37180 SinglePointCount=946 TotalPointCount=35.1723M
BM_StrokePolyline/stroke_Cubic_Square_Bevel_uv           9321 ns         9296 ns        74695 SinglePointCount=906 TotalPointCount=67.6737M
BM_StrokePolyline/stroke_Cubic_Round_Bevel_uv            9391 ns         9328 ns        74795 SinglePointCount=906 TotalPointCount=67.7643M
BM_Polyline/quad_polyline                                3261 ns         3251 ns       213397 SinglePointCount=147 TotalPointCount=31.3694M
BM_Polyline/quad_polyline_tess                          28425 ns        28093 ns        24694 SinglePointCount=447 TotalPointCount=11.0382M
BM_StrokePolyline/stroke_Quadratic_Butt_Bevel            4686 ns         4662 ns       149020 SinglePointCount=890 TotalPointCount=132.628M
BM_StrokePolyline/stroke_Quadratic_Butt_Miter            5316 ns         5308 ns       131909 SinglePointCount=781 TotalPointCount=103.021M
BM_StrokePolyline/stroke_Quadratic_Butt_Round           16550 ns        16530 ns        42153 SinglePointCount=941 TotalPointCount=39.666M
BM_StrokePolyline/stroke_Quadratic_Square_Bevel          4666 ns         4659 ns       150954 SinglePointCount=890 TotalPointCount=134.349M
BM_StrokePolyline/stroke_Quadratic_Round_Bevel           4637 ns         4633 ns       151038 SinglePointCount=890 TotalPointCount=134.424M
BM_StrokePolyline/stroke_Quadratic_Butt_Bevel_uv         9016 ns         9007 ns        79549 SinglePointCount=890 TotalPointCount=70.7986M
BM_StrokePolyline/stroke_Quadratic_Butt_Miter_uv         8673 ns         8663 ns        80139 SinglePointCount=781 TotalPointCount=62.5886M
BM_StrokePolyline/stroke_Quadratic_Butt_Round_uv        18329 ns        18277 ns        38338 SinglePointCount=941 TotalPointCount=36.0761M
BM_StrokePolyline/stroke_Quadratic_Square_Bevel_uv       8883 ns         8874 ns        79421 SinglePointCount=890 TotalPointCount=70.6847M
BM_StrokePolyline/stroke_Quadratic_Round_Bevel_uv        8999 ns         8993 ns        74913 SinglePointCount=890 TotalPointCount=66.6726M
BM_Convex/rrect_convex                                   1163 ns         1162 ns       609475 SinglePointCount=36 TotalPointCount=21.9411M
BM_StrokePolyline/stroke_RRect_Butt_Bevel                 782 ns          781 ns       912159 SinglePointCount=115 TotalPointCount=104.898M
BM_StrokePolyline/stroke_RRect_Butt_Bevel_uv             1477 ns         1476 ns       475114 SinglePointCount=115 TotalPointCount=54.6381M

MAKE_STROKE_BENCHMARK_CAPTURE##uv(path, Butt, Bevel); \
MAKE_STROKE_BENCHMARK_CAPTURE##uv(path, Butt, Miter); \
MAKE_STROKE_BENCHMARK_CAPTURE##uv(path, Butt, Round); \
MAKE_STROKE_BENCHMARK_CAPTURE##uv(path, Square, Bevel); \
Copy link
Contributor

Choose a reason for hiding this comment

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

Why leave off combos like Square + Miter?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I could add them. I just thought that we should test one attribute at a time, as I describe in the "notes" comment above.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, yeah - makes sense. I don't think we need the full combinatorial set.

Copy link
Contributor Author

@flar flar Feb 13, 2024

Choose a reason for hiding this comment

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

Though all combinations are tested for both uv and non-uv. I could go either way on filling out the rest of the cap/join combinations. Note that it would take us from 5 to 9 variations * 2 path types * UV/nonUV

Copy link
Contributor

@jonahwilliams jonahwilliams left a comment

Choose a reason for hiding this comment

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

LGTM w/ question

@flar flar added the autosubmit Merge PR when tree becomes green via auto submit App label Feb 13, 2024
@auto-submit auto-submit bot merged commit 03889fe into flutter:main Feb 13, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Feb 14, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Feb 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

autosubmit Merge PR when tree becomes green via auto submit App e: impeller

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants