Optimize ComparisonCompactor in ComparisonFailure

Remove duplicate prefix/suffix compaction, modularize methods for computing shared prefixes/suffixes, introduce thread-safety. Improve general code readability.