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

Distance-based mutator adjustments, extended api #19

Merged
merged 7 commits into from
Dec 12, 2023
Merged

Conversation

DavJCosby
Copy link
Owner

implements:

  • set_at_dir_from(), set_at_angle_from()
  • index and index range [] operators
  • get_closest(), get_closest_mut(), set_closest()
  • get_closest_to(), get_closest_to_mut(), set_closest_to() for Vec<&Led> and Vec<&mut Led>

Improves most get/set at/within implementations. Those that are relative to the center point make use of each led's distance property to skip some of the more complicated steps the other methods have to take.

@DavJCosby DavJCosby added e/api Improving a method in the API, or adding a new one e/performance Changes intended to improve performance labels Dec 12, 2023
@DavJCosby DavJCosby added this to the 0.2.0 milestone Dec 12, 2023
Copy link

Benchmark for c34aa22

Click to view benchmark
Test Base PR %
for_each 233.1±2.80ns 237.9±5.66ns +2.06%
for_each_in_range 85.5±0.77ns 90.7±2.02ns +6.08%
for_each_in_segment 47.8±1.55ns 47.1±1.02ns -1.46%
for_each_vertex 6.3±0.19ns 6.2±0.21ns -1.59%
map_by_index 233.8±6.81ns 238.6±7.10ns +2.05%
set 0.9±0.01ns 0.9±0.03ns 0.00%
set_all 234.2±7.03ns 237.8±6.11ns +1.54%
set_at_angle 16.5±0.37ns 16.5±0.25ns 0.00%
set_at_dist 136.2±2.69ns 579.4±16.66ns +325.40%
set_at_dist_from 136.6±3.05ns 582.2±28.60ns +326.21%
set_closest_to 37.9±0.61ns 37.8±0.45ns -0.26%
set_range 85.8±2.32ns 90.6±1.30ns +5.59%
set_segment 36.0±0.78ns 40.4±0.85ns +12.22%
set_vertex 0.9±0.02ns 0.9±0.02ns 0.00%
set_vertices 6.3±0.22ns 8.0±0.24ns +26.98%
set_within_dist 315.9±6.12ns 1277.5±20.91ns +304.40%
set_within_dist_from 499.7±12.36ns 515.5±59.61ns +3.16%

Copy link

Benchmark for 851b759

Click to view benchmark
Test Base PR %
map_by_index 1544.0±39.96ns 1547.5±47.35ns +0.23%
set 5.0±0.14ns 5.0±0.24ns 0.00%
set_all 1546.2±42.57ns 1546.9±38.83ns +0.05%
set_at_angle 180.8±3.03ns 181.2±2.59ns +0.22%
set_at_dist 908.8±37.10ns 822.7±18.31ns -9.47%
set_at_dist_from 916.4±19.33ns 826.7±15.12ns -9.79%
set_closest_to 202.3±9.15ns 200.1±4.14ns -1.09%
set_range 202.5±4.46ns 201.8±5.20ns -0.35%
set_segment 226.1±5.21ns 292.7±12.59ns +29.46%
set_vertex 10.0±0.17ns 10.0±0.15ns 0.00%
set_vertices 37.0±1.00ns 30.3±1.24ns -18.11%
set_within_dist 1389.0±76.89ns 1412.2±74.24ns +1.67%
set_within_dist_from 2.3±0.04µs 2.4±0.05µs +4.35%

@DavJCosby DavJCosby merged commit 9f3cab2 into master Dec 12, 2023
2 checks passed
Copy link

Benchmark for 4963962

Click to view benchmark
Test Base PR %
map_by_index 1547.3±46.82ns 1551.0±41.91ns +0.24%
set 6.9±0.24ns 5.0±0.11ns -27.54%
set_all 1549.0±55.54ns 1553.1±37.45ns +0.26%
set_at_angle 181.4±2.73ns 182.2±3.84ns +0.44%
set_at_dist 818.0±18.15ns 820.6±22.21ns +0.32%
set_at_dist_from 822.2±17.97ns 823.1±18.78ns +0.11%
set_closest_to 200.1±3.78ns 202.9±5.53ns +1.40%
set_range 200.0±3.93ns 201.6±10.21ns +0.80%
set_segment 294.0±22.71ns 292.7±12.51ns -0.44%
set_vertex 10.0±0.20ns 10.0±0.26ns 0.00%
set_vertices 30.2±1.54ns 30.8±1.87ns +1.99%
set_within_dist 1404.7±61.91ns 1401.9±49.75ns -0.20%
set_within_dist_from 2.4±0.07µs 2.4±0.05µs 0.00%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
e/api Improving a method in the API, or adding a new one e/performance Changes intended to improve performance
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

1 participant