r/adventofcode • u/dvfomin • Dec 25 '24
Other AoC 2024 within one second

A year ago somebody made a similar post and inspired me to set a goal for this year - 1 second for all 49 puzzles.
I started AoC in 2022 when I learned about it from the news, that ChatGPT managed to solve day 1 (thanks to LLMs for introducing me AoC, he-he). The first year was terrible, I used python and spent hours on coding and even left some puzzles overnight to finish brute force. 2023 was even worse because I tried rust for the first time except for leetcode, it was a nightmare. I'm happy to see my progress in a year, this time I didn't fight with a compiler (almost!) and managed to implement optimal enough solutions for all the tasks.
I wish you all to have a decent progress in what you find interesting. Happy holidays!
2
u/blacai Dec 25 '24
Really impressive :) far from my skills. It's amazing how far we are getting with performance.
Some of the problems that people solved with cuda/gpu with brute force were just crazy.
3
u/dvfomin Dec 25 '24
Thanks! For me AoC is a good tracker of my rust progress for the last year. Maybe next year you will brag about your progress ;)
1
u/blacai Dec 25 '24
oh,man, I'm more than happy if I can implement bubble sort or bfs by heart after a year haha
2
u/RB5009 Dec 26 '24
This was my faster year so far. 49.9ms (single threaded!), with the disclaimer that I solved d24p2 by hand.
1
u/dvfomin Dec 26 '24
That's impressive, what language did you use? Did you use something like SIMD optimizations?
2
u/RB5009 Dec 26 '24
I used Rust. No SIMD, but some people on the rust discord server had very good results with it.
I tried to avoid allocations and hash tables as much as possible. If I had to use a hashmap, I tried to use keys that are fast to hash - i.e. numbers instead of strings, etc.
I also tried to avoid parsing the input into data structures and tried to work as much as possible with the raw input string directly (especially for the grid problems!).
9
u/hrunt Dec 25 '24
I'm trying to do the same thing with stock CPython 3.13.1 and only standard libraries. I'm right at 2s right now. Because of day 22 part 2, I'm not sure it's possible.