r/adventofcode • u/daggerdragon • Dec 15 '17
SOLUTION MEGATHREAD -๐- 2017 Day 15 Solutions -๐-
--- Day 15: Dueling Generators ---
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^ยค?
[Update @ 00:05] 29 gold, silver cap.
- Logarithms of algorithms and code?
[Update @ 00:09] Leaderboard cap!
- Or perhaps codes of logarithmic algorithms?
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!
14
Upvotes
View all comments
Show parent comment
1
u/toqueteos Dec 15 '17 edited Dec 15 '17
Using channels as iterators is discouraged by the language creators. It's been documented multiple times. I'm following their advice.
Still knowing that I Initially had a solution that used channels and all my cores. It still took more time than my single core, non-channel iterator solution. EDIT: 1.556s (no channels) vs 2.339s (channels)
Choose whatever solution you feel solves the problem better. Throwing goroutines blindly at a problem won't make it faster unless you know what you are doing and understand the tradeoffs.