• Here's today's, feel like recursive calls would have been better than storing the possible paths in a stack. Or a tree structure of paths would be quite efficient.

    https://github.com/jyates13/aoc2021/blob/main/d12/d12.py

    Edit: first one that's taken a noticable amount of time to run, the rest were all effectively instant

  • Edit: first one that's taken a noticable amount of time to run, the rest were all effectively instant

    Yep, if I want to try and get my total execution time (for all days) down below 1s (which I did for one year) then this will need more work. Got it down to 0.6s and then down to 0.4s with one simple change (removing the entry from my 'visited' hash at the end of each recursion rather than copying it before each recursion). Think that's about the limit of the current perl implementation, I'd guess I could get a C implementation down to under 0.01s without too much fuss but lack the time do that now.

About

Avatar for frankenbike @frankenbike started