[llvm] r330419 - [UpdateTestChecks] Fix update_mca_test_checks.py slowness issue

Greg Bedwell via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 20 04:38:11 PDT 2018


Author: gbedwell
Date: Fri Apr 20 04:38:11 2018
New Revision: 330419

URL: http://llvm.org/viewvc/llvm-project?rev=330419&view=rev
Log:
[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.

Modified:
    llvm/trunk/utils/update_mca_test_checks.py

Modified: llvm/trunk/utils/update_mca_test_checks.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/update_mca_test_checks.py?rev=330419&r1=330418&r2=330419&view=diff
==============================================================================
--- llvm/trunk/utils/update_mca_test_checks.py (original)
+++ llvm/trunk/utils/update_mca_test_checks.py Fri Apr 20 04:38:11 2018
@@ -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
   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(




More information about the llvm-commits mailing list