Skip to content
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

Tessellate: Implement precomputed vertices for rounding #1507

Closed
wants to merge 3 commits into from

Conversation

dbuch
Copy link
Contributor

@dbuch dbuch commented Apr 16, 2022

Before:

demo_with_tessellate__realistic
                        time:   [328.77 us 329.22 us 329.70 us]
                        change: [-2.6116% -1.1978% +0.2520%] (p = 0.10 > 0.05)
                        No change in performance detected.

demo_no_tessellate      time:   [164.67 us 165.82 us 167.30 us]

demo_only_tessellate    time:   [159.34 us 159.85 us 160.67 us]

After:

demo_with_tessellate__realistic
                        time:   [309.48 us 309.92 us 310.41 us]
                        change: [-7.1042% -5.6164% -4.0262%] (p = 0.00 < 0.05)
                        Performance has improved.

demo_no_tessellate      time:   [160.44 us 161.30 us 162.49 us]
                        change: [-4.5692% -2.8617% -1.3549%] (p = 0.00 < 0.05)
                        Performance has improved.

demo_only_tessellate    time:   [139.45 us 140.23 us 141.25 us]
                        change: [-13.637% -12.245% -10.695%] (p = 0.00 < 0.05)
                        Performance has improved.

Not sure this is the right path. So i didn't bother to port Path::add_point()

Also we might want to fallback to computed vertices for radii >= 20 or add
another precomputed batch.

Before:
demo_with_tessellate__realistic
                        time:   [328.77 us 329.22 us 329.70 us]
                        change: [-2.6116% -1.1978% +0.2520%] (p = 0.10 > 0.05)
                        No change in performance detected.

demo_no_tessellate      time:   [164.67 us 165.82 us 167.30 us]

demo_only_tessellate    time:   [159.34 us 159.85 us 160.67 us]

After:
demo_with_tessellate__realistic
                        time:   [309.48 us 309.92 us 310.41 us]
                        change: [-7.1042% -5.6164% -4.0262%] (p = 0.00 < 0.05)
                        Performance has improved.

demo_no_tessellate      time:   [160.44 us 161.30 us 162.49 us]
                        change: [-4.5692% -2.8617% -1.3549%] (p = 0.00 < 0.05)
                        Performance has improved.

demo_only_tessellate    time:   [139.45 us 140.23 us 141.25 us]
                        change: [-13.637% -12.245% -10.695%] (p = 0.00 < 0.05)
                        Performance has improved.

Not sure this is the right path. So i didn't bother to port Path::add_point()

Also we might want to fallback to computed vertices for radii >= 20 or add
another precomputed batch.
epaint/src/tessellator.rs Outdated Show resolved Hide resolved
epaint/src/tessellator.rs Outdated Show resolved Hide resolved
epaint/src/tessellator.rs Outdated Show resolved Hide resolved
Copy link
Owner

@emilk emilk left a comment

Choose a reason for hiding this comment

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

Those are pretty good speedups!

vec2(0.707107, -0.707107),
vec2(0.923880, -0.382683),
vec2(1.000000, 0.000000),
],
Copy link
Owner

Choose a reason for hiding this comment

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

Instead of having the four quadrants in separate array, we could just have all the circle vertices in circular order, and just slice into it. That way we could reuse the same vertices for circles too! It can wait for a separate PR though if you want.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants