r/adventofcode • • Dec 05 '16

Upping the Ante [2016 - Day 5] [C++] STAYING ON TARGET with Parallelism

How to stay on target: compute MD5s in parallel.

You can get away with processing a block of N in parallel because there won't be collisions in a given block of small enough size (avalanche effect).

Running on my 2013 MacBook Pro (unplugged), compiled using AppleClang with optimization flags, I compute part 2 in a little over 1.1 seconds.

Code: https://github.com/willkill07/adventofcode2016/blob/master/src/Day05.cpp

Mandatory bonus video: http://imgur.com/qCSxwDf

14 Upvotes

27 comments sorted by

View all comments

Show parent comment

1

u/mmstick Dec 06 '16

It could also be caused by jemalloc. I've been explicitly disabling it to use the system allocator instead, which is sometimes faster and cuts down on the amount of required memory needed.

1

u/willkill07 Dec 06 '16

I checked on my ArchLinux workstation: libc++ runs circles around libstdc++

2

u/mmstick Dec 06 '16

libc++ is free of legacy cruft found in the GNU libstdc++ so that would make sense.