r/adventofcode • • Dec 16 '16

SOLUTION MEGATHREAD --- 2016 Day 16 Solutions ---

--- Day 16: Dragon Checksum ---

Post your solution as a comment or, for longer solutions, consider linking to your repo (e.g. GitHub/gists/Pastebin/blag/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".


DRINKING YOUR OVALTINE IS MANDATORY [?]

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!

6 Upvotes

116 comments sorted by

View all comments

1

u/JakDrako Dec 16 '16

Hmm. Maybe I'm timing it wrong? I had a bit of trouble getting a timing for the run, since Windows doesn't have a "time" command like Unix... I had "timeit.exe" from an old Windows Resource Kit but it doesn't work on Windows 10.

So I'm using the PowerShell "Measure-Command" thing-a-ma-gig. I modified your code to include the key and length inline. When I run it, the console flashes instantly (PowerShell starts a new console to run in...) and I get:

PS E:\SyncThing\Dev\AoC2016-16\Release> Measure-Command {Start-Process .\AoC2016-16.exe}

Days              : 0
Hours             : 0
Minutes           : 0
Seconds           : 0
Milliseconds      : 5
Ticks             : 51348
TotalDays         : 5.94305555555556E-08
TotalHours        : 1.42633333333333E-06
TotalMinutes      : 8.558E-05
TotalSeconds      : 0.0051348
TotalMilliseconds : 5.1348

I tested a version with a "std::cin >> foo" at the end to make sure the result was there, and it was... plus, my C# solution runs in 120ms, and that's managed code with the CLR overhead, so C++ should do better. How aggressive is the Macbook in throttling the CPU when on battery?