Skip to content

Commit dd25f73

Browse files
committed
Fix inclusive range performance regression introduced by 1.90
1 parent 77b7639 commit dd25f73

File tree

6 files changed

+13
-13
lines changed

6 files changed

+13
-13
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,12 @@ Performance is reasonable even on older hardware, for example a 2011 MacBook Pro
123123
| 14 | [Parabolic Reflector Dish](https://adventofcode.com/2023/day/14) | [Source](src/year2023/day14.rs) | 632 |
124124
| 15 | [Lens Library](https://adventofcode.com/2023/day/15) | [Source](src/year2023/day15.rs) | 84 |
125125
| 16 | [The Floor Will Be Lava](https://adventofcode.com/2023/day/16) | [Source](src/year2023/day16.rs) | 160 |
126-
| 17 | [Clumsy Crucible](https://adventofcode.com/2023/day/17) | [Source](src/year2023/day17.rs) | 2289 |
126+
| 17 | [Clumsy Crucible](https://adventofcode.com/2023/day/17) | [Source](src/year2023/day17.rs) | 2379 |
127127
| 18 | [Lavaduct Lagoon](https://adventofcode.com/2023/day/18) | [Source](src/year2023/day18.rs) | 17 |
128128
| 19 | [Aplenty](https://adventofcode.com/2023/day/19) | [Source](src/year2023/day19.rs) | 100 |
129129
| 20 | [Pulse Propagation](https://adventofcode.com/2023/day/20) | [Source](src/year2023/day20.rs) | 6 |
130130
| 21 | [Step Counter](https://adventofcode.com/2023/day/21) | [Source](src/year2023/day21.rs) | 182 |
131-
| 22 | [Sand Slabs](https://adventofcode.com/2023/day/22) | [Source](src/year2023/day22.rs) | 54 |
131+
| 22 | [Sand Slabs](https://adventofcode.com/2023/day/22) | [Source](src/year2023/day22.rs) | 40 |
132132
| 23 | [A Long Walk](https://adventofcode.com/2023/day/23) | [Source](src/year2023/day23.rs) | 68 |
133133
| 24 | [Never Tell Me The Odds](https://adventofcode.com/2023/day/24) | [Source](src/year2023/day24.rs) | 95 |
134134
| 25 | [Snowverload](https://adventofcode.com/2023/day/25) | [Source](src/year2023/day25.rs) | 179 |
@@ -175,7 +175,7 @@ Performance is reasonable even on older hardware, for example a 2011 MacBook Pro
175175
| 2 | [Dive!](https://adventofcode.com/2021/day/2) | [Source](src/year2021/day02.rs) | 12 |
176176
| 3 | [Binary Diagnostic](https://adventofcode.com/2021/day/3) | [Source](src/year2021/day03.rs) | 22 |
177177
| 4 | [Giant Squid](https://adventofcode.com/2021/day/4) | [Source](src/year2021/day04.rs) | 8 |
178-
| 5 | [Hydrothermal Venture](https://adventofcode.com/2021/day/5) | [Source](src/year2021/day05.rs) | 181 |
178+
| 5 | [Hydrothermal Venture](https://adventofcode.com/2021/day/5) | [Source](src/year2021/day05.rs) | 158 |
179179
| 6 | [Lanternfish](https://adventofcode.com/2021/day/6) | [Source](src/year2021/day06.rs) | 1 |
180180
| 7 | [The Treachery of Whales](https://adventofcode.com/2021/day/7) | [Source](src/year2021/day07.rs) | 8 |
181181
| 8 | [Seven Segment Search](https://adventofcode.com/2021/day/8) | [Source](src/year2021/day08.rs) | 14 |

src/year2015/day14.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ pub fn part2_testable(input: &[Reindeer], time: u32) -> u32 {
2727
let mut scores = vec![0; input.len()];
2828
let mut distances = vec![0; input.len()];
2929

30-
for minute in 1..=time {
30+
for minute in 0..time {
3131
let mut furthest = 0;
3232

3333
for (index, &reindeer) in input.iter().enumerate() {
34-
let next = distance(reindeer, minute);
34+
let next = distance(reindeer, minute + 1);
3535
distances[index] = next;
3636
furthest = furthest.max(next);
3737
}

src/year2021/day05.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ fn vents(input: Vec<[usize; 4]>, grid: &mut [u8]) -> usize {
4444
let delta = (y2 - y1).signum() * 1000 + (x2 - x1).signum();
4545
let mut index = y1 * 1000 + x1;
4646

47-
for _ in 0..=count {
47+
for _ in 0..count + 1 {
4848
if grid[index as usize] == 1 {
4949
result += 1;
5050
}

src/year2023/day04.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pub fn part2(input: &[usize]) -> u32 {
2626
let mut copies = vec![1; input.len()];
2727

2828
for (i, &n) in input.iter().enumerate() {
29-
(1..=n).for_each(|j| copies[i + j] += copies[i]);
29+
(0..n).for_each(|j| copies[i + j + 1] += copies[i]);
3030
}
3131

3232
copies.iter().sum()

src/year2023/day17.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ fn astar<const L: i32, const U: i32>(grid: &Grid<i32>) -> i32 {
102102
let mut next = index;
103103
let mut extra = steps;
104104

105-
for i in 1..=U {
105+
for i in 1..U + 1 {
106106
if x + i >= size {
107107
break;
108108
}
@@ -120,7 +120,7 @@ fn astar<const L: i32, const U: i32>(grid: &Grid<i32>) -> i32 {
120120
let mut next = index;
121121
let mut extra = steps;
122122

123-
for i in 1..=U {
123+
for i in 1..U + 1 {
124124
if i > x {
125125
break;
126126
}
@@ -140,7 +140,7 @@ fn astar<const L: i32, const U: i32>(grid: &Grid<i32>) -> i32 {
140140
let mut next = index;
141141
let mut extra = steps;
142142

143-
for i in 1..=U {
143+
for i in 1..U + 1 {
144144
if y + i >= size {
145145
break;
146146
}
@@ -158,7 +158,7 @@ fn astar<const L: i32, const U: i32>(grid: &Grid<i32>) -> i32 {
158158
let mut next = index;
159159
let mut extra = steps;
160160

161-
for i in 1..=U {
161+
for i in 1..U + 1 {
162162
if i > y {
163163
break;
164164
}

src/year2023/day22.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,11 @@ pub fn parse(input: &str) -> Input {
9595

9696
// Find the highest z coordinate underneath the brick looking downwards along the z axis
9797
// so only considering x and y coordinates.
98-
for j in (start..=end).step_by(step) {
98+
for j in (start..end + 1).step_by(step) {
9999
top = top.max(heights[j]);
100100
}
101101

102-
for j in (start..=end).step_by(step) {
102+
for j in (start..end + 1).step_by(step) {
103103
if heights[j] == top {
104104
let index = indices[j];
105105
if index != previous {

0 commit comments

Comments
 (0)