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

triangulate-spade: small optimization, potentially up to a factor of 1/2 #1207

Merged
merged 1 commit into from
Aug 8, 2024

Conversation

RobWalt
Copy link
Contributor

@RobWalt RobWalt commented Aug 2, 2024

Just found this when randomly inspecting the code.

Benchmarking results after the optimization:

TriangulateSpade (unconstrained) - small polys
                        time:   [7.7546 ms 7.7579 ms 7.7615 ms]
                        change: [-0.1240% -0.0645% -0.0048%] (p = 0.04 < 0.05)
                        Change within noise threshold.
Found 9 outliers among 100 measurements (9.00%)
  5 (5.00%) high mild
  4 (4.00%) high severe

Benchmarking TriangulateSpade (constrained) - small polys: Warming up for 3.0000 s
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 51.6s, or reduce sample count to 10.
TriangulateSpade (constrained) - small polys
                        time:   [512.64 ms 513.03 ms 513.44 ms]
                        change: [-10.101% -10.023% -9.9359%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 1 outliers among 100 measurements (1.00%)
  1 (1.00%) high mild

TriangulateEarcut - small polys
                        time:   [4.2893 ms 4.2922 ms 4.2949 ms]
                        change: [+0.5207% +0.6343% +0.7477%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 16 outliers among 100 measurements (16.00%)
  6 (6.00%) low severe
  7 (7.00%) low mild
  1 (1.00%) high mild
  2 (2.00%) high severe

TriangulateSpade (unconstrained) - large_poly
                        time:   [3.4148 ms 3.4174 ms 3.4204 ms]
                        change: [+0.7127% +0.8072% +0.9017%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 3 outliers among 100 measurements (3.00%)
  1 (1.00%) high mild
  2 (2.00%) high severe

Benchmarking TriangulateSpade (constrained) - large_poly: Warming up for 3.0000 s
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 91.7s, or reduce sample count to 10.
TriangulateSpade (constrained) - large_poly
                        time:   [916.72 ms 917.95 ms 919.33 ms]
                        change: [-10.563% -10.367% -10.184%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 3 outliers among 100 measurements (3.00%)
  3 (3.00%) high severe

Benchmarking TriangulateEarcut - large_poly: Warming up for 3.0000 s
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 7.3s, enable flat sampling, or reduce sample count to 50.
TriangulateEarcut - large_poly
                        time:   [1.4410 ms 1.4438 ms 1.4474 ms]
                        change: [-0.7569% -0.5342% -0.3114%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 12 outliers among 100 measurements (12.00%)
  7 (7.00%) high mild
  5 (5.00%) high severe
  • I agree to follow the project's code of conduct.
  • I added an entry to CHANGES.md if knowledge of this change could be valuable to users.

Benchmarking results after the optimization:

```
TriangulateSpade (unconstrained) - small polys
                        time:   [7.7546 ms 7.7579 ms 7.7615 ms]
                        change: [-0.1240% -0.0645% -0.0048%] (p = 0.04 < 0.05)
                        Change within noise threshold.
Found 9 outliers among 100 measurements (9.00%)
  5 (5.00%) high mild
  4 (4.00%) high severe

Benchmarking TriangulateSpade (constrained) - small polys: Warming up for 3.0000 s
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 51.6s, or reduce sample count to 10.
TriangulateSpade (constrained) - small polys
                        time:   [512.64 ms 513.03 ms 513.44 ms]
                        change: [-10.101% -10.023% -9.9359%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 1 outliers among 100 measurements (1.00%)
  1 (1.00%) high mild

TriangulateEarcut - small polys
                        time:   [4.2893 ms 4.2922 ms 4.2949 ms]
                        change: [+0.5207% +0.6343% +0.7477%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 16 outliers among 100 measurements (16.00%)
  6 (6.00%) low severe
  7 (7.00%) low mild
  1 (1.00%) high mild
  2 (2.00%) high severe

TriangulateSpade (unconstrained) - large_poly
                        time:   [3.4148 ms 3.4174 ms 3.4204 ms]
                        change: [+0.7127% +0.8072% +0.9017%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 3 outliers among 100 measurements (3.00%)
  1 (1.00%) high mild
  2 (2.00%) high severe

Benchmarking TriangulateSpade (constrained) - large_poly: Warming up for 3.0000 s
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 91.7s, or reduce sample count to 10.
TriangulateSpade (constrained) - large_poly
                        time:   [916.72 ms 917.95 ms 919.33 ms]
                        change: [-10.563% -10.367% -10.184%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 3 outliers among 100 measurements (3.00%)
  3 (3.00%) high severe

Benchmarking TriangulateEarcut - large_poly: Warming up for 3.0000 s
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 7.3s, enable flat sampling, or reduce sample count to 50.
TriangulateEarcut - large_poly
                        time:   [1.4410 ms 1.4438 ms 1.4474 ms]
                        change: [-0.7569% -0.5342% -0.3114%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 12 outliers among 100 measurements (12.00%)
  7 (7.00%) high mild
  5 (5.00%) high severe
```
Copy link
Member

@michaelkirk michaelkirk left a comment

Choose a reason for hiding this comment

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

Nice find!

@michaelkirk michaelkirk added this pull request to the merge queue Aug 8, 2024
Merged via the queue into georust:main with commit 23dd26c Aug 8, 2024
15 checks passed
@RobWalt RobWalt deleted the triangulate-spade-optimization branch August 9, 2024 05:28
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