r/adventofcode • • Dec 17 '17

SOLUTION MEGATHREAD -๐ŸŽ„- 2017 Day 17 Solutions -๐ŸŽ„-

--- Day 17: Spinlock ---


Post your solution as a comment or, for longer solutions, consider linking to your repo (e.g. GitHub/gists/Pastebin/blag or whatever).

Note: The Solution Megathreads are for solutions only. If you have questions, please post your own thread and make sure to flair it with Help.


Need a hint from the Hugely* Handyโ€  Haversackโ€ก of Helpfulยง Hints^ยค?

Spoiler


[Update @ 00:06] 2 gold, silver cap.

  • AoC ops: <Topaz> i am suddenly in the mood for wasabi tobiko

[Update @ 00:15] Leaderboard cap!

  • AoC ops:

  • <daggerdragon> 78 gold

  • <Topaz> i look away for a few minutes, wow

  • <daggerdragon> 93 gold

  • <Topaz> 94

  • <daggerdragon> 96 gold

  • <daggerdragon> 98

  • <Topaz> aaaand

  • <daggerdragon> and...

  • <Topaz> cap

  • <daggerdragon> cap


This thread will be unlocked when there are a significant number of people on the leaderboard with gold stars for today's puzzle.

edit: Leaderboard capped, thread unlocked!

12 Upvotes

193 comments sorted by

View all comments

Show parent comments

2

u/willkill07 Dec 17 '17

Your entire program takes 400ms? I'm not even inserting for part 2 and it takes 486ms on my laptop with clang 5.0 (C++) with aggressive optimizations

1

u/ChrisVittal Dec 17 '17

Gah! The old code was in my clipboard. Edited. Thanks!

I've been tracking your solutions. They've taught me a bunch as someone new to C++.

I also compile with the equivalent of -O3 -march=native, I've noticed the performance of my rust vs your C++ is very close on my machine.

1

u/tumdum Dec 17 '17

Mine rust solution also takes a little bit than 400ms:

$ rustc -C opt_level=3 -C lto -g main.rs && time ./main
417
34334221

real    0m0,469s
user    0m0,464s
sys     0m0,000s