My solutions to Eric Wastl's Advent of Code 2024 in C, C++, and Python.
Below I timed the runtime of my solutions on my input files. All timing done on Apple M4 Pro.
Differences in timing between languages depend on my level of familiariy with the language, the efficiency of that language itself, and the different method or algorithm I happened to choose when solving that puzzle in that language, and how long I actually spend trying to make it fast. Also, sometimes the language I use first will be faster because the second time I implement a solution I understand the problem better.
C |
C++ |
Java |
Python |
||
---|---|---|---|---|---|
⭐️⭐️ | Day 1 | 255 ± 15 μs | 189 ± 32 μs | 511 ± 32 μs | |
⭐️⭐️ | Day 2 | 253 ± 16 μs | 174 ± 23 μs | 1,381 ± 44 μs | |
⭐️⭐️ | Day 3 | 299 ± 17 μs | 1,445 ± 150 μs | 430 ± 20 μs | |
⭐️⭐️ | Day 4 | 708 ± 28 μs | 140,717 ± 1,724 μs | ||
⭐️⭐️ | Day 5 | 218 ± 14 μs | 1,604 ± 41 μs | ||
⭐️⭐️ | Day 6 | 17,147 ± 298 μs | |||
⭐️⭐️ | Day 7 | 11,156 ± 115 μs | 632,115 ± 4,733 μs | ||
⭐️⭐️ | Day 8 | 48 ± 4 μs | |||
⭐️⭐️ | Day 9 | 152,341 ± 2,065 μs | |||
⭐️⭐️ | Day 10 | 136 ± 8 μs | 4,474 ± 129 μs | ||
⭐️⭐️ | Day 11 | 41,705 ± 1,056 μs | |||
⭐️⭐️ | Day 12 | 35,211 ± 581 μs | |||
⭐️⭐️ | Day 13 | 6,734 ± 111 μs | |||
⭐️⭐️ | Day 14 | 154,662 ± 3,187 μs | |||
⭐️⭐️ | Day 15 | 24,814 ± 666 μs | |||
⭐️ | Day 16 | ||||
⭐️ | Day 17 | ||||
⭐️⭐️ | Day 18 | 504,794 ± 5,652 μs | |||
⭐️⭐️ | Day 19 | 6,571 ± 90 μs | 844,754 ± 27,729 μs | ||
Daa 20 | |||||
Day 21 | |||||
Day 22 | |||||
Day 23 | |||||
Day 24 | |||||
Day 25 |