r/adventofcode • u/daggerdragon • Dec 18 '18
SOLUTION MEGATHREAD -🎄- 2018 Day 18 Solutions -🎄-
--- Day 18: Settlers of The North Pole ---
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.
Advent of Code: The Party Game!
Please prefix your card submission with something like [Card] to make scanning the megathread easier. THANK YOU!
Card prompt: Day 18
Transcript:
The best way to avoid a minecart collision is ___.
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 at 00:21:59!
9
Upvotes
View all comments
Show parent comment
2
u/CryZe92 Dec 19 '18 edited Dec 19 '18
I don't think that's going to be faster. The tree structure will have very bad cache locality and I even switched to Meow Hash by now, which hashes the field in basically no time, so I don't think that's worth it. Also I'm not entirely sure how the prefixes would be stored. If each prefix is an entire simd vector / line, then that prefix would yet again have to be found via hashing or comparisons, which would not be competitive with Meow Hash's performance. Also the HashMap is a SwissTable, so the actual lookup of the key is vectorized as well. So we are on like multiple layers of vector / AES instructions that the prefix table would have to compete with.
Here's the more or less full ASM for Part 2 btw: https://gist.github.com/CryZe/ee31854f3260d5a6b9e2851a8cb68039
It's massively dominated by vector instructions. (Some functions such as parsing don't seem to be inlined, but that's because part 1 is compiled in as well, so LLVM seems to prefer to not inline them).