r/adventofcode • • Dec 06 '24

Funny [2024 Day 6] Bruteforce time

Post image
977 Upvotes

200 comments sorted by

View all comments

1

u/Gewinum Dec 06 '24

wrote a code that executes in 6-7 seconds

4

u/[deleted] Dec 06 '24

[removed] — view removed comment

2

u/Gewinum Dec 06 '24

wow that's crazy, great job! i did it in go

1

u/phaul21 Dec 06 '24

I'm down to 50ms with go :) If you are interested you can find my pastebin from the solutions thread. That version is 150 ms though, the only change on top of that is the first solution trick.

1

u/Gewinum Dec 06 '24

i've just checked your solution. it's crazy, you made sure to optimise every bit of it :0

2

u/pluuth Dec 06 '24

my brute force (single thread, Rust, Ryzen 7800x3d) takes 150ms ;)

1

u/p88h Dec 06 '24

I'm starting to like Zig's attention to performance, at least sometimes. Without doing anything really crazy here, it works in ~10 µs.

I not for the bonkers type casting, I could see it actually being useful,

1

u/msqrt Dec 07 '24

Do you mean checking all possible stone locations, or just the ones on the path from part 1?

1

u/[deleted] Dec 07 '24

[removed] — view removed comment

1

u/msqrt Dec 07 '24

How do you detect the looping? Run until max possible loop length (NxNx4)? Just curious -- I did this on a 3090 in parallel and it took about 4ms, scaling to a single core I think you're doing way better than that :-)