[UpdateTestChecks] Fix update_mca_test_checks.py slowness issue

The script was using Python's difflib module to calculate the number of
lines changed so that it could report it in its status output.  It turns
out this can be very very slow on large sets of lines (Python bug 6931).
It's not worth the cost, so just remove the usage of difflib entirely.

llvm-svn: 330419
This commit is contained in:
Greg Bedwell 2018-04-20 11:38:11 +00:00
parent 690dcf12c2
commit d22b35b48c
1 changed files with 1 additions and 8 deletions

View File

@ -8,7 +8,6 @@ FileCheck patterns.
import argparse
from collections import defaultdict
import difflib
import glob
import os
import sys
@ -313,13 +312,7 @@ def _write_output(test_path, input_lines, prefix_list, block_infos, # noqa
if input_lines == output_lines:
sys.stderr.write(' [unchanged]\n')
return
diff = list(difflib.Differ().compare(input_lines, output_lines))
sys.stderr.write(
' [{} lines total ({} added, {} removed)]\n'.format(
len(output_lines),
len([l for l in diff if l[0] == '+']),
len([l for l in diff if l[0] == '-'])))
sys.stderr.write(' [{} lines total]\n'.format(len(output_lines)))
if args.verbose:
sys.stderr.write(