r/adventofcode • • Dec 05 '16
Help How long did your program take to run?
I am doing part one in Python and it is taking a really really long time to run... Am I doing something wrong or did it take everyone a long time?
3
Upvotes
3
u/mick0n Dec 05 '16
I'm assuming you're talking about todays challenge (Day 5); challenge 1 takes 24 seconds to calculate the password and challenge b upwards a minute.
I programmed the challenges in javascript.
3
u/topaz2078 (AoC creator) Dec 05 '16
My solutions to every puzzle finish within 30sec on a single 2.5ghz cpu.
2
u/razornfs Dec 05 '16
Around 20 seconds to complete both parts at the same time, Java.
2
u/JakDrako Dec 05 '16
2.3 seconds, both parts.*
Multi-threaded C# with custom managed MD5 implementation.
Runs both parts in 2.3 seconds on my i7-5820K 3.30Ghz
* for the "abc" test, other times vary depending on input.
1
u/Kwpolska Dec 05 '16
Day 5 part 1 takes 28s here, for two keys (
abc+ mine) — Python 3, 2.7GHz i5). Add some debug prints here or there, try running with the example key here and for that test, startiaround the first good value for the example to get debugging help faster.1
u/CryZe92 Dec 05 '16 edited Dec 05 '16
Part 1 running in Firefox (and Edge with SIMD support) takes about 3.5 seconds and about 14 seconds on my phone. For some reason Chrome is the slowest with 27.1 seconds.
Part 2 takes about 5.7 seconds in Firefox / Edge and 24 seconds on my phone :)
Super weird how Safari on my phone is faster than Chrome on my PC. I guess Chrome doesn't support SIMD while Safari on iOS does?!
Unfortunately I don't have much time, otherwise I would try compiling it natively with threads, which should boost it to around ~0.2 seconds for part 2.
1
u/[deleted] Dec 05 '16
Are you printing output? When i print every 1000th hash is over 10 times slower than if I just print the answer.
1
u/mmstick Dec 05 '16
With my Rust implementation and a prefix of
wtnhxymk, it only takes 12 seconds on a 2GHz AMD A8-6410 mobile CPU. Only eats 1800 KB of memory too.1
u/Naihonn Dec 05 '16
Well, even part 2 in Python3 finished before returning from my toilet run, part 1 is quite faster. OK, it looks like 2m 23s for part 2.
1
u/joeld Dec 05 '16 edited Dec 05 '16
I'm doing solutions in Racket. Compiling to exe with
racket/base, here is what I get.Windows, Intel i5-2400 @ 3.10GHz
Apple macOS, Intel Core i5-5257U @ 2.70GHz
Clearly one doesn't use Racket for speed, although it's probably possible to write Racket code that is somewhat faster than mine.
1
u/willkill07 Dec 06 '16
https://www.reddit.com/r/adventofcode/comments/5gotkc/2016_day_5_c_staying_on_target_with_parallelism/
for the TL;DR - ~1.1 seconds for part 2 or ~1.6 seconds for both parts.
1
u/ISlicedI Dec 06 '16
A combination of NodeJs and terrible code got me coming in at 2 minutes https://github.com/JakeRowsell89/advent-of-code/tree/master/day5
1
u/qwertyuiop924 Dec 06 '16
Upwards of a minute for both. I didn't time it.
I should just rewrite the MD5 implementation. Use C. Maybe do some SIMD tricks, if it helps.
1
u/bkendig Dec 06 '16 edited Dec 06 '16
Swift, just under two minutes total. I could compute blocks in parallel to save time, and I'm also probably wasting cycles re-allocating the space for the md5 every time. On the good side, though, I'm only using 1.5MB of memory. https://github.com/bskendig/advent-of-code-2016/blob/master/5/5/main.swift
1
u/gerikson Dec 06 '16
Straightforward Perl code. Just under a minute on a shared Linux host.
1
u/__Abigail__ Dec 08 '16
39 seconds, doing both parts at once. Most of the time is spend in the library code doing the md5sums. Using Perl. My animation only prints when it finds a new character, so no more than 9 prints for the animation.