Stream: advent of code

Topic: 2023 Day 16


view this post on Zulip Fabian Schmalzried (Dec 16 2023 at 21:52):

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.

view this post on Zulip Oskar Hahn (Dec 17 2023 at 09:16):

Here is mine: https://github.com/ostcar/aoc2023/blob/main/days/day16.roc

About Part2

view this post on Zulip Ryan Bates (Dec 18 2023 at 18:46):

Here's my day 16: https://github.com/ryanb/advent-2023-roc/blob/main/day16/main.roc

Part 2 Performance

view this post on Zulip Johan Lindskogen (Dec 18 2023 at 21:24):

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)

view this post on Zulip Marten (Dec 19 2023 at 06:53):

@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

view this post on Zulip Johan Lindskogen (Dec 19 2023 at 06:56):

@Marten That’s awesome, thank you! Will try it out today for sure!


Last updated: Jul 06 2025 at 12:14 UTC