Skip to content

Commit

Permalink
2024-15: Fix lints
Browse files Browse the repository at this point in the history
  • Loading branch information
fornwall committed Dec 15, 2024
1 parent ba81686 commit 87f849e
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions crates/core/src/year2024/day15.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub fn solve(input: &Input) -> Result<u32, String> {

struct Grid {
width: usize,
cells: [u8; 75*75],
cells: [u8; 75 * 75],
robot_position: (i32, i32),
}

Expand All @@ -33,7 +33,7 @@ impl Grid {
let mut height = 0;
let mut width = 0;
let mut robot_position = (0, 0);
let mut cells = [0_u8; 75*75];
let mut cells = [0_u8; 75 * 75];
let mut cells_size = 0;
let width_multiplier = if part1 { 1 } else { 2 };

Expand All @@ -50,7 +50,6 @@ impl Grid {
}
if part1 {
cells[cells_size] = b;
cells_size += 1;
} else {
let (b1, b2) = match b {
b'@' => (b'@', b'.'),
Expand All @@ -60,8 +59,8 @@ impl Grid {
cells[cells_size] = b1;
cells_size += 1;
cells[cells_size] = b2;
cells_size += 1;
}
cells_size += 1;
});
height += 1;
}
Expand All @@ -81,7 +80,7 @@ impl Grid {
})
}

fn at(&self, position: (i32, i32)) -> u8 {
const fn at(&self, position: (i32, i32)) -> u8 {
self.cells[position.1 as usize * self.width + position.0 as usize]
}

Expand Down

1 comment on commit 87f849e

@github-actions
Copy link

Choose a reason for hiding this comment

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

@@                     Benchmark Difference                     @@
#      Name   Old (instructions)   New (instructions)   Change (%)
  2024_16_1           10,000,000           10,000,000            0
  2024_16_2           10,000,000           10,000,000            0
  2024_17_1           10,000,000           10,000,000            0
  2024_17_2           10,000,000           10,000,000            0
  2024_18_1           10,000,000           10,000,000            0
  2024_18_2           10,000,000           10,000,000            0
  2024_19_1           10,000,000           10,000,000            0
  2024_19_2           10,000,000           10,000,000            0
  2024_20_1           10,000,000           10,000,000            0
  2024_20_2           10,000,000           10,000,000            0
  2024_21_1           10,000,000           10,000,000            0
  2024_21_2           10,000,000           10,000,000            0
  2024_22_1           10,000,000           10,000,000            0
  2024_22_2           10,000,000           10,000,000            0
  2024_23_1           10,000,000           10,000,000            0
  2024_23_2           10,000,000           10,000,000            0
  2024_24_1           10,000,000           10,000,000            0
  2024_24_2           10,000,000           10,000,000            0
  2024_25_1           10,000,000           10,000,000            0
   2024_1_1            1,041,088            1,041,088            0
   2024_1_2            1,070,180            1,070,180            0
   2024_2_1            1,741,514            1,741,514            0
   2024_2_2            1,962,905            1,962,905            0
   2024_3_1              227,379              227,379            0
   2024_3_2              317,752              317,752            0
   2024_4_1            1,213,771            1,213,771            0
   2024_4_2              453,901              453,901            0
   2024_5_1            1,605,046            1,605,046            0
   2024_5_2            1,718,988            1,718,988            0
   2024_6_1              641,454              641,454            0
   2024_6_2          141,310,078          141,310,078            0
   2024_7_1            2,466,893            2,466,893            0
   2024_7_2            3,758,402            3,758,402            0
   2024_8_1               44,405               44,405            0
   2024_8_2               86,862               86,862            0
   2024_9_1              897,540              897,540            0
   2024_9_2            2,497,020            2,497,020            0
  2024_10_1            1,087,487            1,087,487            0
  2024_10_2            1,089,386            1,089,386            0
  2024_11_1            1,090,137            1,089,730            0
  2024_11_2           36,464,832           36,466,809            0
  2024_12_1            7,663,694            7,663,694            0
  2024_12_2            7,942,245            7,942,245            0
  2024_13_1              910,454              910,454            0
  2024_13_2              910,208              910,208            0
  2024_14_1              593,112              593,112            0
  2024_14_2           13,416,623           13,416,623            0
  2024_15_1            1,913,992            1,913,992            0
  2024_15_2           59,667,647           59,667,647            0
Benchmark Instructions (count) Instructions (%)
2024_6_2 141,310,078 29.1
2024_15_2 59,667,647 12.3
2024_11_2 36,466,809 7.5
2024_14_2 13,416,623 2.8
2024_25_1 10,000,000 2.1
2024_24_2 10,000,000 2.1
2024_24_1 10,000,000 2.1
2024_23_2 10,000,000 2.1
2024_23_1 10,000,000 2.1
2024_22_2 10,000,000 2.1
2024_22_1 10,000,000 2.1
2024_21_2 10,000,000 2.1
2024_21_1 10,000,000 2.1
2024_20_2 10,000,000 2.1
2024_20_1 10,000,000 2.1
2024_19_2 10,000,000 2.1
2024_19_1 10,000,000 2.1
2024_18_2 10,000,000 2.1
2024_18_1 10,000,000 2.1
2024_17_2 10,000,000 2.1
2024_17_1 10,000,000 2.1
2024_16_2 10,000,000 2.1
2024_16_1 10,000,000 2.1
2024_12_2 7,942,245 1.6
2024_12_1 7,663,694 1.6
2024_7_2 3,758,402 0.8
2024_9_2 2,497,020 0.5
2024_7_1 2,466,893 0.5
2024_2_2 1,962,905 0.4
2024_15_1 1,913,992 0.4
2024_2_1 1,741,514 0.4
2024_5_2 1,718,988 0.4
2024_5_1 1,605,046 0.3
2024_4_1 1,213,771 0.2
2024_11_1 1,089,730 0.2
2024_10_2 1,089,386 0.2
2024_10_1 1,087,487 0.2
2024_1_2 1,070,180 0.2
2024_1_1 1,041,088 0.2
2024_13_1 910,454 0.2
2024_13_2 910,208 0.2
2024_9_1 897,540 0.2
2024_6_1 641,454 0.1
2024_14_1 593,112 0.1
2024_4_2 453,901 0.1
2024_3_2 317,752 0.1
2024_3_1 227,379 0.0
2024_8_2 86,862 0.0
2024_8_1 44,405 0.0

Please sign in to comment.