Skip to content

Commit

Permalink
Cleanup 2024-20
Browse files Browse the repository at this point in the history
  • Loading branch information
fornwall committed Dec 21, 2024
1 parent 702271d commit da2d678
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions crates/core/src/year2024/day20.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,15 @@ pub fn solve(input: &Input) -> Result<u32, String> {
}

let mut start_location = (0, 0);
let mut end_location = (0, 0);
for y in 0..grid.width {
for x in 0..grid.width {
match grid.at((x, y)) {
b'S' => start_location = (x, y),
b'E' => end_location = (x, y),
_ => {}
if grid.at((x, y)) == b'S' {
start_location = (x, y);
}
}
}
if start_location == (0, 0) {
return Err("No start location".to_string());
} else if end_location == (0, 0) {
return Err("No end location".to_string());
}

let mut costs = [[u16::MAX; MAX_GRID_SIZE]; MAX_GRID_SIZE];
Expand Down

1 comment on commit da2d678

@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_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            3,848,401            3,848,345            0
  2024_11_2           13,462,485           13,462,290            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
  2024_16_1           18,233,703           18,233,703            0
  2024_16_2           18,321,269           18,321,269            0
  2024_17_1               11,725               11,725            0
  2024_17_2              218,087              218,087            0
  2024_18_1            1,103,427            1,103,427            0
  2024_18_2            1,427,027            1,427,027            0
  2024_19_1            2,242,630            2,242,630            0
  2024_19_2            2,242,690            2,242,690            0
  2024_20_1            7,199,422            7,190,091            0
  2024_20_2          241,095,069          241,085,738            0
Benchmark Instructions (count) Instructions (%)
2024_20_2 241,085,738 36.7
2024_6_2 141,310,078 21.5
2024_15_2 59,667,647 9.1
2024_16_2 18,321,269 2.8
2024_16_1 18,233,703 2.8
2024_11_2 13,462,290 2.0
2024_14_2 13,416,623 2.0
2024_25_1 10,000,000 1.5
2024_24_2 10,000,000 1.5
2024_24_1 10,000,000 1.5
2024_23_2 10,000,000 1.5
2024_23_1 10,000,000 1.5
2024_22_2 10,000,000 1.5
2024_22_1 10,000,000 1.5
2024_21_2 10,000,000 1.5
2024_21_1 10,000,000 1.5
2024_12_2 7,942,245 1.2
2024_12_1 7,663,694 1.2
2024_20_1 7,190,091 1.1
2024_11_1 3,848,345 0.6
2024_7_2 3,758,402 0.6
2024_9_2 2,497,020 0.4
2024_7_1 2,466,893 0.4
2024_19_2 2,242,690 0.3
2024_19_1 2,242,630 0.3
2024_2_2 1,962,905 0.3
2024_15_1 1,913,992 0.3
2024_2_1 1,741,514 0.3
2024_5_2 1,718,988 0.3
2024_5_1 1,605,046 0.2
2024_18_2 1,427,027 0.2
2024_4_1 1,213,771 0.2
2024_18_1 1,103,427 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.1
2024_13_2 910,208 0.1
2024_9_1 897,540 0.1
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.0
2024_3_1 227,379 0.0
2024_17_2 218,087 0.0
2024_8_2 86,862 0.0
2024_8_1 44,405 0.0
2024_17_1 11,725 0.0

Please sign in to comment.