Skip to content

Commit

Permalink
new benchmark now uses modulate methods instead of get_mut
Browse files Browse the repository at this point in the history
  • Loading branch information
DavJCosby committed Dec 13, 2023
1 parent fadaca4 commit 047127c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions sandbox/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,14 @@ fn step(sled: &mut Sled, elapsed: f32) -> Result<(), SledError> {

for i in 0..GREEN_COUNT {
let angle = inner_time_scale + (TAU / GREEN_COUNT as f32) * i as f32;
sled.get_at_angle_mut(angle).unwrap().color += inner_color;
sled.modulate_at_angle(angle, |led| led.color + inner_color)
.unwrap();
}

for i in 0..BLUE_COUNT {
let angle = outer_time_scale + (TAU / BLUE_COUNT as f32) * i as f32 % TAU;
sled.get_at_angle_mut(angle).unwrap().color += outer_delta;
sled.modulate_at_angle(angle, |led| led.color + outer_delta)
.unwrap();
}

let radar_time_scale = elapsed / TRAIL_RADIUS;
Expand Down
6 changes: 4 additions & 2 deletions sled/benches/quirky_trail.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@ fn step(sled: &mut Sled, elapsed: f32) {

for i in 0..GREEN_COUNT {
let angle = inner_time_scale + (TAU / GREEN_COUNT as f32) * i as f32;
sled.get_at_angle_mut(angle).unwrap().color += inner_color;
sled.modulate_at_angle(angle, |led| led.color + inner_color)
.unwrap();
}

for i in 0..BLUE_COUNT {
let angle = outer_time_scale + (TAU / BLUE_COUNT as f32) * i as f32 % TAU;
sled.get_at_angle_mut(angle).unwrap().color += outer_delta;
sled.modulate_at_angle(angle, |led| led.color + outer_delta)
.unwrap();
}

let radar_time_scale = elapsed / TRAIL_RADIUS;
Expand Down

0 comments on commit 047127c

Please sign in to comment.