https://github.com/FabHof/aoc-2023/blob/main/day16/main.roc
Part 2 was simple again, if performance on part 1 is not horrible, part 2 is no problem.
Here is mine: https://github.com/ostcar/aoc2023/blob/main/days/day16.roc
About Part2
Here's my day 16: https://github.com/ryanb/advent-2023-roc/blob/main/day16/main.roc
Part 2 Performance
I was completely stuck in terms of performance in part 2. Taking inspiration from this thread, I manage to solve it finally, albeit with performance from hell. https://github.com/lindskogen/advent-of-code-2023/blob/main/day16/main.roc
(Takes about 208s (~3min) to find both solutions)
@Johan Lindskogen I heard from the Dec online meet-up that there's a refcounting bug with strings, and that a hack around that is using u8 instead.
I replaced Str with U8 in your code, and it ran in 235 millis.
Way faster than my own hacky day 16 code which runs in about 7 seconds :D
@Marten That’s awesome, thank you! Will try it out today for sure!
Last updated: Jul 06 2025 at 12:14 UTC