Advent of Code 2021 - all solutions

So I finished all the 2021 solutions in Erlang with a total runtime of < 10s which I am very happy with:

Year    Day    Name                     Time (msecs)
------  -----  -----------------------  --------------
2021    24     Arithmetic Logic Unit    0.338
2021    10     Syntax Scoring           0.717
2021    2      Dive!                    0.773
2021    1      Sonar Sweep              0.849
2021    6      Lanternfish              0.963
2021    13     Transparent Origami      2.112
2021    3      Binary Diagnostics       2.619
2021    14     Extended Polymerization  4.008
2021    16     Packet Decoder           4.83
2021    8      Seven Segment Stretch    7.495
2021    9      Smoke Basin              13.564
2021    4      Giant Squid              23.715
2021    22     Reactor Reboot           40.28
2021    11     Dumbo Octopus            58.305
2021    7      The Treachery of Whales  91.935
2021    21     Dirac Dice               140.429
2021    17     Trick Shot               160.075
2021    12     Passage Pathing          274.693
2021    5      Hydrothermal Venture     321.489
2021    18     Snailfish                409.204
2021    15     Chiton                   732.866
2021    25     Sea Cucumber             781.054
2021    19     Beacon Scanner           1934.517
2021    23     Amphipod                 2031.776
2021    20     Trench Map               2361.754
               Total time               9.43458 secs

All solutions can be found here: GitHub - jesperes/aoc_erlang: Advent of Code Solutions in Erlang.

9 Likes

Awesome stuff Jesper, I wonder if anyone else completed all of them? :003:

I guess @bjorng did? :lol:

2 Likes

I’ve done all the previous years in Erlang, but this is the first year that I managed to break the 10s barrier.

5 Likes

I participated for the first time, and sometime it was painful - but no doubt it’s real fun in general. Thank you @bjorng for letting know about AoC in the mailing list and thank you @jesperes for the benchmark and additional motivation to revisit some of 25 days without haste :wink:

3 Likes

It was my first time too. I like the idea very much and I had great time working in AoC, though often it was tough time as well :slight_smile: You can find my Erlang solutions to all problems at GitHub - wojteksurowka/aoc2021

3 Likes

It was such a fun to revisit AoC2021 with C++, improving at last day 23 (hooray) and compare it to Erlang. More often than not I tried to repeat C++ solutions by the corresponding Erlang code, so funnier it was to see how eventual implementation differs and a cunning scheme designed for one language doesn’t work for another. Final timings say us nothing as always :slight_smile: but I share them anyway.

$ ./aoc2021
25 C++ days:
Time elapsed:
    day 1: 1.4ms
    day 2: 0.9ms
    day 3: 1.1ms
    day 4: 7.1ms
    day 5: 5.5ms
    day 6: 0.1ms
    day 7: 3.4ms
    day 8: 9.7ms
    day 9: 12.2ms
    day 10: 0.3ms
    day 11: 63.5ms
    day 12: 141.5ms
    day 13: 3.7ms
    day 14: 3.4ms
    day 15: 1732.7ms
    day 16: 0.5ms
    day 17: 2.7ms
    day 18: 122.1ms
    day 19: 75.5ms
    day 20: 130.2ms
    day 21: 89.6ms
    day 22: 1061.7ms
    day 23: 5845.2ms
    day 24: 0.1ms
    day 25: 173.7ms
Average: 379.5ms
2> aoc_tc:run().
25 Erlang days:
    day 1: 0.702ms
    day 2: 0.531ms
    day 3: 0.952ms
    day 4: 12.308ms
    day 5: 250.932ms
    day 6: 0.379ms
    day 7: 4.208ms
    day 8: 1.595ms
    day 9: 4.938ms
    day 10: 0.422ms
    day 11: 29.911ms
    day 12: 35.826ms
    day 13: 2.442ms
    day 14: 3.953ms
    day 15: 1353.175ms
    day 16: 0.61ms
    day 17: 1.511ms
    day 18: 74.62ms
    day 19: 34.571ms
    day 20: 1743.531ms
    day 21: 86.588ms
    day 22: 1288.99ms
    day 23: 2200.571ms
    day 24: 0.006ms
    day 25: 2209.278ms
Total: 9342.55ms
Average: 373.702ms

Solutions are here: VyacheslavLevytskyy (Vyacheslav Levytskyy) · GitHub

2 Likes