Hello everyone! It’s Ukrainian Erlanger here ! I hope you had a relaxing weekend and recharged for the upcoming work week . Let’s dive back into solving the Advent of Code challenges for Day 4! Wishing you a happy coding experience and a fantastic Monday!
Back to a weekday - guess he has planned weekends to be more time consuming
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 .
Not very fast, but here it is. I could probably speed it up by pre-scoring the cards as others in this thread did.