Similar content calculation performance improvements

A refactor of similar content calculations which eliminates the need
to scan over all content for each target by pre-computing a set of
hashes.