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

Some more perf improvements #9

Merged
merged 5 commits into from Oct 7, 2022
Merged

Some more perf improvements #9

merged 5 commits into from Oct 7, 2022

Conversation

mockersf
Copy link
Member

@mockersf mockersf commented Oct 7, 2022

  • when searching for the polygon on the other side of the edge, stop as soon as it's found instead of going through all the vertices neighbours
  • no need to peek when checking in which polygon a point is
  • some more unsafe for things that are already checked
  • generalise using u32 in some place instead of usize
group                                             main                        this PR
-----                                             ----                        -------
baking                                            1.02      4.6±0.06ms        1.00      4.5±0.06ms
get path Vec2(0.0, 0.0)-Vec2(0.0, 0.0)            1.21     12.0±0.12µs        1.00      9.9±0.10µs
get path Vec2(0.0, 0.0)-Vec2(575.0, 410.0)        1.22     12.0±0.14µs        1.00      9.9±0.12µs
get path Vec2(233.0, 323.0)                       1.08  1590.0±16.29µs        1.00  1470.1±19.35µs
get path Vec2(297.0, 438.0)-Vec2(575.0, 410.0)    1.58     64.8±0.52µs        1.00     41.1±0.41µs
get path Vec2(356.0, 166.0)                       1.09  1635.2±18.64µs        1.00  1503.2±18.61µs
get path Vec2(458.0, 47.0)-Vec2(575.0, 410.0)     1.14     24.2±0.26µs        1.00     21.2±0.24µs
get path Vec2(468.0, 584.0)                       1.09  1183.3±16.07µs        1.00  1087.9±29.04µs
get path Vec2(512.0, 170.0)                       1.09  1473.3±19.72µs        1.00  1351.1±24.13µs
get path Vec2(575.0, 410.0)-Vec2(0.0, 0.0)        1.30     16.4±0.15µs        1.00     12.6±0.15µs
get path Vec2(575.0, 410.0)-Vec2(458.0, 47.0)     1.10     11.9±0.16ms        1.00     10.9±0.15ms
get path Vec2(611.0, 658.0)                       1.09  1657.6±18.14µs        1.00  1521.2±21.64µs
get path Vec2(827.0, 678.0)                       1.09  1708.0±21.05µs        1.00  1572.6±19.49µs
get path Vec2(993.0, 290.0)                       1.09      3.2±0.03ms        1.00      2.9±0.03ms
is in mesh Vec2(131.0, 669.0)                     1.32      2.9±0.03µs        1.00      2.2±0.02µs
is in mesh Vec2(135.0, 360.0)                     1.60    892.4±7.17ns        1.00    556.8±5.48ns
is in mesh Vec2(22.0, 432.0)                      1.31  1476.8±16.24ns        1.00  1128.0±11.21ns
is in mesh Vec2(308.0, 147.0)                     1.72      2.9±0.04µs        1.00  1666.1±19.25ns
is in mesh Vec2(575.0, 410.0)                     1.71      4.2±0.04µs        1.00      2.5±0.02µs
is in mesh Vec2(728.0, 148.0)                     2.40      4.5±0.04µs        1.00  1864.5±24.99ns
is not in mesh Vec2(0.0, 0.0)                     1.22     12.1±0.12µs        1.00      9.9±0.10µs
is not in mesh Vec2(297.0, 438.0)                 1.57     64.9±0.54µs        1.00     41.4±0.51µs
is not in mesh Vec2(521.0, 90.0)                  1.69     68.0±1.30µs        1.00     40.2±0.42µs
is not in mesh Vec2(726.0, 470.0)                 1.71     71.1±0.66µs        1.00     41.7±0.59µs
is not in mesh Vec2(969.0, 726.0)                 2.19     59.7±0.59µs        1.00     27.2±0.28µs

@mockersf mockersf merged commit 206e770 into main Oct 7, 2022
@mockersf mockersf deleted the some-more-perf branch March 9, 2024 20:21
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.

None yet

1 participant