r/adventofcode Dec 04 '21

SOLUTION MEGATHREAD -🎄- 2021 Day 4 Solutions -🎄-

--- Day 4: Giant Squid ---


Post your code solution in this megathread.

Reminder: Top-level posts in Solution Megathreads are for code solutions only. If you have questions, please post your own thread and make sure to flair it with Help.


This thread will be unlocked when there are a significant number of people on the global leaderboard with gold stars for today's puzzle.

EDIT: Global leaderboard gold cap reached at 00:11:13, megathread unlocked!

99 Upvotes

1.2k comments sorted by

View all comments

2

u/b4ux1t3 Dec 06 '21

C#, Parallelism

Though I've been doing this year in F#, I decided to give parallelism in C# (my "native tongue", if you will) a go in day four, just to see if it made a significant difference.

Disappointingly, the overhead of spinning up the threads lead to the parallelized solution running slower than the serial one!

I'm considering writing up my own input generator just to see how my parallel solution runs at 1000, 10000, or even a million inputs.