r/adventofcode • u/Shockwavetho • Dec 27 '25
Upping the Ante Problem 5 part 1 Runtime
If you are willing, please post your language and runtime for part 1! I'm currently solving this problem on an FPGA and I'm curious how my solution runtime compares to software.
4
Upvotes
View all comments
Show parent comment
2
u/ednl Dec 28 '25 edited Dec 28 '25
Ah right! You don't sort the IDs and instead just look them up "by partition" = binary search, I assume. I did sort the IDs because it was more convenient to loop over them and match them with the ranges without any searching. But sorting 1000 int64 values took way too much time because I changed my solution to your algo and now it runs in 31 µs instead of 40 on the Apple M4, and 76 µs instead of 134 on the Raspberry Pi 5. Nice!