Advent of Code 2023 - Day 4

Hello everyone! It’s Ukrainian Erlanger here :metal:! I hope you had a relaxing weekend and recharged for the upcoming work week :upside_down_face:. Let’s dive back into solving the Advent of Code challenges for Day 4! Wishing you a happy coding experience and a fantastic Monday! :blush:

2 Likes

Back to a weekday - guess he has planned weekends to be more time consuming

Day 4

1 Like

Day 4

Interestingly enough I found that a single worker parsing the input ended up being twice as fast as my multi-worker version, where I split the input into chunks to parse the cards. Splitting into workers helped in the case of directly solving the problem (Splitting the problem into 16 workers/chunks for the parsing step took the runtime from 3 ms down to 1 ms), but if I repeatedly ran the function then it operated in 0.5 ms regardless. I am drawing the conclusion that one worker, after the JIT has kicked in, is going much faster than marshaling the and spreading the load across my CPU cores. This may have been different had the input been longer .

1 Like

My day 4 solution in Erlang

1 Like

Not very fast, but here it is. I could probably speed it up by pre-scoring the cards as others in this thread did.

1 Like